Files
pybricks-api/doc/api/pupdevices/pfmotor.rst
T
Laurens Valk b5890437de doc/pupdevices/PFMotor: 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:48:09 +01:00

46 lines
1.3 KiB
ReStructuredText

Power Functions
^^^^^^^^^^^^^^^^^^^^^^^^^
The :class:`ColorDistanceSensor <pybricks.pupdevices.ColorDistanceSensor>` can
send infrared signals to control Power Functions infrared receivers. You can
use this technique to control medium, large, extra large, and train
motors. The infrared range is limited to about 30 cm, depending on the angle
and ambient conditions.
.. figure:: ../../api/images/pfmotor.png
:width: 95 %
Powered Up
:class:`ColorDistanceSensor <pybricks.pupdevices.ColorDistanceSensor>`
(left), Power Functions infrared receiver (middle), and a Power Functions
motor (right). Here, the receiver uses channel
1 with a motor on the red port.
.. autoclass:: pybricks.pupdevices.PFMotor
:noindex:
:no-members:
.. automethod:: pybricks.pupdevices.PFMotor.dc
:noindex:
.. automethod:: pybricks.pupdevices.PFMotor.stop
:noindex:
.. automethod:: pybricks.pupdevices.PFMotor.brake
:noindex:
Examples
-------------------
Control a Power Functions motor
*******************************
.. literalinclude::
../../../examples/pup/motor_pf/motor_pf_basics.py
Controlling multiple Power Functions motors
*******************************************
.. literalinclude::
../../../examples/pup/motor_pf/motor_pf_pwm.py