From 8a9386ffc5cac423ba8a69f8c68e48b43f06822f Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Tue, 21 Jul 2020 13:47:04 +0200 Subject: [PATCH] doc/pupdevices: add DCMotor examples --- doc/api/pupdevices.rst | 18 ++++++++++++++++++ pybricks-projects | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/api/pupdevices.rst b/doc/api/pupdevices.rst index 2840b33..94e1294 100644 --- a/doc/api/pupdevices.rst +++ b/doc/api/pupdevices.rst @@ -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: diff --git a/pybricks-projects b/pybricks-projects index c6a3d7a..f749c26 160000 --- a/pybricks-projects +++ b/pybricks-projects @@ -1 +1 @@ -Subproject commit c6a3d7a66e0af12d5f971549e89bf03133b204b6 +Subproject commit f749c26e4c1ec5bd43a0fca336026674cbdd09d9