Files
pybricks-api/examples/pup/sensor_tilt/basics.py
T
Laurens Valk d00bf35c66 all: ruff check --fix.
Mainly fixes and sorts imports.
2026-08-25 12:22:28 +02:00

17 lines
404 B
Python

from pybricks.parameters import Port
from pybricks.pupdevices import TiltSensor
from pybricks.tools import wait
# Initialize the sensor.
accel = TiltSensor(Port.A)
while True:
# Read the tilt angles relative to the horizontal plane.
pitch, roll = accel.tilt()
# Print the values
print("Pitch:", pitch, "Roll:", roll)
# Wait some time so we can read what is printed.
wait(100)