mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 17:14:41 +00:00
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.
46 lines
1.3 KiB
ReStructuredText
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
|