doc/pupdevices: add DCMotor examples

This commit is contained in:
Laurens Valk
2020-07-21 14:50:26 +02:00
parent bcd44dad84
commit 8a9386ffc5
2 changed files with 19 additions and 1 deletions
+18
View File
@@ -17,6 +17,24 @@ Motors without Rotation Sensors
Powered Up motors without rotation sensors. The arrows indicate the default
positive direction.
.. toggle-header::
:header: **Show/hide examples**
**Example 1: Making the motor move back and forth**
.. literalinclude::
../../pybricks-projects/snippets/pup/motor_dc/motor_dc_init_basic.py
**Example 2: Seting the positive direction as counterclockwise**
.. literalinclude::
../../pybricks-projects/snippets/pup/motor_dc/motor_dc_init_direction.py
**Example 3: Starting and stopping**
.. literalinclude::
../../pybricks-projects/snippets/pup/motor_dc/motor_dc_stop.py
.. autoclass:: pybricks._common.DCMotor
:noindex:
:no-members: