examples/pup/primehub: auto rotate display

This commit is contained in:
Laurens Valk
2021-01-20 11:05:09 +01:00
parent 018b0d8b9d
commit 1573508f75
2 changed files with 22 additions and 0 deletions
+3
View File
@@ -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)