diff --git a/doc/api/pupdevices.rst b/doc/api/pupdevices.rst index 3e1bae1..91f8442 100644 --- a/doc/api/pupdevices.rst +++ b/doc/api/pupdevices.rst @@ -205,19 +205,23 @@ Infrared Sensor .. automethod:: pybricks.pupdevices.InfraredSensor.count -.. Tilt Sensor -.. ^^^^^^^^^^^^^^^^^^^^^^^^^ +Tilt Sensor +^^^^^^^^^^^^^^^^^^^^^^^^^ -.. .. autoclass:: pybricks.pupdevices.TiltSensor +.. figure:: ../api/images/sensor_tilt.png + :width: 35 % + + +.. autoclass:: pybricks.pupdevices.TiltSensor :no-members: - .. automethod:: neutral - - .. automethod:: acceleration - .. automethod:: tilt - .. automethod:: up +.. .. automethod:: neutral + +.. .. automethod:: acceleration + +.. .. automethod:: up .. Remote Control diff --git a/pybricks/pupdevices.py b/pybricks/pupdevices.py index 4f296bc..dec45af 100644 --- a/pybricks/pupdevices.py +++ b/pybricks/pupdevices.py @@ -3,7 +3,7 @@ """LEGO® Powered Up motor, sensors, and lights.""" -from ._common import (KeyPad as _KeyPad, Accelerometer as _Accelerometer, +from ._common import (KeyPad as _KeyPad, ColorLight as _ColorLight, Motor as _Motor, LightArray as _LightArray, Light as _Light) @@ -43,17 +43,25 @@ class RemoteControl: pass -class TiltSensor(_Accelerometer): +class TiltSensor: """LEGO® Powered Up Tilt Sensor.""" def __init__(self, port): - """TiltSensor(port) + """ Arguments: port (Port): Port to which the sensor is connected. """ pass + def tilt(self): + """Measures the tilt relative to the horizontal plane. + + Returns: + (:ref:`angle`, :ref:`angle`): Tuple of pitch and roll angles. + """ + pass + class ColorDistanceSensor: """LEGO® Powered Up Color and Distance Sensor."""