Files
pybricks-api/doc/api/pupdevices/ultrasonicsensor.rst
T
Laurens Valk b0af924cfc doc/pupdevices/UltrasonicSensor: split examples
Now that each device is on its own page, we no longer need to collapse snippets to reduce page size. Now they can just all be at the bottom of the page. This also gives each a dedicated link which is easier when giving support.
2020-12-29 14:47:06 +01:00

37 lines
957 B
ReStructuredText

Ultrasonic Sensor
^^^^^^^^^^^^^^^^^^^^^^^^^
.. figure:: ../../api/images/sensor_ultrasonic_lights_label.png
:width: 80 %
.. autoclass:: pybricks.pupdevices.UltrasonicSensor
:no-members:
.. automethod:: pybricks.pupdevices.UltrasonicSensor.distance
.. automethod:: pybricks.pupdevices.UltrasonicSensor.presence
.. rubric:: Built-in lights
This sensor has 4 built-in lights. You can adjust the brightness of each
light.
.. automethod:: pybricks.pupdevices::UltrasonicSensor.lights.on
.. automethod:: pybricks.pupdevices::UltrasonicSensor.lights.off
Examples
-------------------
Measuring distance and switching on the lights
**********************************************
.. literalinclude::
../../../examples/pup/sensor_ultrasonic/basics.py
Gradually change the brightness of the lights
**********************************************
.. literalinclude::
../../../examples/pup/sensor_ultrasonic/math.py