mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 17:14:41 +00:00
examples/pup/primehub: auto rotate display
This commit is contained in:
@@ -145,6 +145,9 @@ Changing the display orientation
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_orientation.py
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_orientation_imu.py
|
||||
|
||||
Making your own images
|
||||
**********************
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
from pybricks.hubs import PrimeHub
|
||||
from pybricks.parameters import Icon
|
||||
from pybricks.tools import wait
|
||||
|
||||
# Initialize the hub.
|
||||
hub = PrimeHub()
|
||||
|
||||
while True:
|
||||
|
||||
# Check which side of the hub is up.
|
||||
up_side = hub.imu.up()
|
||||
|
||||
# Use this side to set the display orientation.
|
||||
hub.display.orientation(up_side)
|
||||
|
||||
# Display something, like an arrow.
|
||||
hub.display.image(Icon.UP)
|
||||
|
||||
wait(10)
|
||||
Reference in New Issue
Block a user