diff --git a/doc/api/hubs/cityhub.rst b/doc/api/hubs/cityhub.rst index 145a0b7..3911be9 100644 --- a/doc/api/hubs/cityhub.rst +++ b/doc/api/hubs/cityhub.rst @@ -15,22 +15,22 @@ City Hub **Example 1: Turning the light on and off** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_cityhub/light_off.py + ../../../examples/pup/hub_cityhub/light_off.py **Example 2: Changing brightness and using custom colors** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_cityhub/light_hsv.py + ../../../examples/pup/hub_cityhub/light_hsv.py **Example 3: Making the light blink** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_cityhub/light_blink.py + ../../../examples/pup/hub_cityhub/light_blink.py **Example 4: Creating light animations** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_cityhub/light_animate.py + ../../../examples/pup/hub_cityhub/light_animate.py .. automethod:: pybricks.hubs::CityHub.light.on diff --git a/doc/api/hubs/ev3brick.rst b/doc/api/hubs/ev3brick.rst index ee02f0d..e820cd5 100644 --- a/doc/api/hubs/ev3brick.rst +++ b/doc/api/hubs/ev3brick.rst @@ -21,7 +21,7 @@ MINDSTORMS EV3 Brick **Example: Turn the light on and change the color.** .. literalinclude:: - ../../../pybricks-projects/snippets/ev3/light_color/main.py + ../../../examples/ev3/light_color/main.py .. automethod:: pybricks.hubs::EV3Brick.light.off @@ -180,7 +180,7 @@ MINDSTORMS EV3 Brick \begin{CJK}{UTF8}{gbsn} .. literalinclude:: - ../../../pybricks-projects/snippets/ev3/screen_print/main.py + ../../../examples/ev3/screen_print/main.py .. raw:: latex @@ -198,7 +198,7 @@ MINDSTORMS EV3 Brick **Example: Show an image on the screen.** .. literalinclude:: - ../../../pybricks-projects/snippets/ev3/screen_image/main.py + ../../../examples/ev3/screen_image/main.py .. automethod:: pybricks.hubs::EV3Brick.screen.draw_image @@ -212,7 +212,7 @@ MINDSTORMS EV3 Brick **Example: Draw some shapes on the screen.** .. literalinclude:: - ../../../pybricks-projects/snippets/ev3/screen_draw/main.py + ../../../examples/ev3/screen_draw/main.py .. automethod:: pybricks.hubs::EV3Brick.screen.draw_box diff --git a/doc/api/hubs/inventorhub.rst b/doc/api/hubs/inventorhub.rst index 0d26503..be30533 100644 --- a/doc/api/hubs/inventorhub.rst +++ b/doc/api/hubs/inventorhub.rst @@ -19,22 +19,22 @@ MINDSTORMS Inventor Hub **Example 1: Turning the light on and off** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_inventorhub/light_off.py + ../../../examples/pup/hub_inventorhub/light_off.py **Example 2: Changing brightness and using custom colors** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_inventorhub/light_hsv.py + ../../../examples/pup/hub_inventorhub/light_hsv.py **Example 3: Making the light blink** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_inventorhub/light_blink.py + ../../../examples/pup/hub_inventorhub/light_blink.py **Example 4: Creating light animations** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_inventorhub/light_animate.py + ../../../examples/pup/hub_inventorhub/light_animate.py .. automethod:: pybricks.hubs::InventorHub.light.on diff --git a/doc/api/hubs/movehub.rst b/doc/api/hubs/movehub.rst index 9827f84..6a61ff4 100644 --- a/doc/api/hubs/movehub.rst +++ b/doc/api/hubs/movehub.rst @@ -17,22 +17,22 @@ BOOST Move Hub **Example 1: Turning the light on and off** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_movehub/light_off.py + ../../../examples/pup/hub_movehub/light_off.py **Example 2: Changing brightness and using custom colors** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_movehub/light_hsv.py + ../../../examples/pup/hub_movehub/light_hsv.py **Example 3: Making the light blink** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_movehub/light_blink.py + ../../../examples/pup/hub_movehub/light_blink.py **Example 4: Creating light animations** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_movehub/light_animate.py + ../../../examples/pup/hub_movehub/light_animate.py .. automethod:: pybricks.hubs::MoveHub.light.on diff --git a/doc/api/hubs/primehub.rst b/doc/api/hubs/primehub.rst index 84574ae..0254f8c 100644 --- a/doc/api/hubs/primehub.rst +++ b/doc/api/hubs/primehub.rst @@ -19,22 +19,22 @@ SPIKE Prime Hub **Example 1: Turning the light on and off** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_primehub/light_off.py + ../../../examples/pup/hub_primehub/light_off.py **Example 2: Changing brightness and using custom colors** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_primehub/light_hsv.py + ../../../examples/pup/hub_primehub/light_hsv.py **Example 3: Making the light blink** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_primehub/light_blink.py + ../../../examples/pup/hub_primehub/light_blink.py **Example 4: Creating light animations** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_primehub/light_animate.py + ../../../examples/pup/hub_primehub/light_animate.py .. automethod:: pybricks.hubs::PrimeHub.light.on diff --git a/doc/api/hubs/technichub.rst b/doc/api/hubs/technichub.rst index d78cbfc..6bdf026 100644 --- a/doc/api/hubs/technichub.rst +++ b/doc/api/hubs/technichub.rst @@ -15,22 +15,22 @@ Technic Hub **Example 1: Turning the light on and off** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_technichub/light_off.py + ../../../examples/pup/hub_technichub/light_off.py **Example 2: Changing brightness and using custom colors** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_technichub/light_hsv.py + ../../../examples/pup/hub_technichub/light_hsv.py **Example 3: Making the light blink** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_technichub/light_blink.py + ../../../examples/pup/hub_technichub/light_blink.py **Example 4: Creating light animations** .. literalinclude:: - ../../../pybricks-projects/snippets/pup/hub_technichub/light_animate.py + ../../../examples/pup/hub_technichub/light_animate.py .. automethod:: pybricks.hubs::TechnicHub.light.on diff --git a/doc/api/iodevices_ev3.inc b/doc/api/iodevices_ev3.inc index 29756dd..976b3ba 100644 --- a/doc/api/iodevices_ev3.inc +++ b/doc/api/iodevices_ev3.inc @@ -19,7 +19,7 @@ I2C Device **Example: Read and write to an I2C device.** - .. literalinclude:: ../../pybricks-projects/snippets/ev3/i2c_basics/main.py + .. literalinclude:: ../../examples/ev3/i2c_basics/main.py .. _i2caddress: @@ -41,7 +41,7 @@ data. You can achieve this behavior as shown in the examples below. **Example: Advanced I2C read and write techniques.** - .. literalinclude:: ../../pybricks-projects/snippets/ev3/i2c_extra/main.py + .. literalinclude:: ../../examples/ev3/i2c_extra/main.py **Additional technical resources** @@ -69,7 +69,7 @@ UART Device **Example: Read and write to a UART device.** .. literalinclude:: - ../../pybricks-projects/snippets/ev3/uart_basics/main.py + ../../examples/ev3/uart_basics/main.py DC Motor ^^^^^^^^^^^^ @@ -132,7 +132,7 @@ visit the `ev3dev sensors`_ page. RGB mode. This gives uncalibrated red, green, and blue reflection values. .. literalinclude:: - ../../pybricks-projects/snippets/ev3/ev3devsensor/main.py + ../../examples/ev3/ev3devsensor/main.py .. toggle-header:: :header: **Show/hide example: Extending the Ev3devSensor class** @@ -143,7 +143,7 @@ visit the `ev3dev sensors`_ page. additional features found in the Linux system folder for this device. .. literalinclude:: - ../../pybricks-projects/snippets/ev3/ev3devsensor/class_example.py + ../../examples/ev3/ev3devsensor/class_example.py .. _ev3dev sensors: http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-stretch/sensors.html .. _Mode name: http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-stretch/sensor_data.html diff --git a/doc/api/messaging.rst b/doc/api/messaging.rst index 6b55815..a41789a 100644 --- a/doc/api/messaging.rst +++ b/doc/api/messaging.rst @@ -71,7 +71,7 @@ and the client can send a message to the server. This is the full version of the excerpt shown in :numref:`fig_messaging`. - .. literalinclude:: ../../pybricks-projects/snippets/ev3/bluetooth_server/server.py + .. literalinclude:: ../../examples/ev3/bluetooth_server/server.py .. toggle-header:: :header: **Show/hide full client example** @@ -80,7 +80,7 @@ and the client can send a message to the server. This is the full version of the excerpt shown in :numref:`fig_messaging`. - .. literalinclude:: ../../pybricks-projects/snippets/ev3/bluetooth_client/client.py + .. literalinclude:: ../../examples/ev3/bluetooth_client/client.py The only difference between the client and the server is which one initiates diff --git a/doc/api/nxtdevices.rst b/doc/api/nxtdevices.rst index fbf86c3..0d7f5e1 100644 --- a/doc/api/nxtdevices.rst +++ b/doc/api/nxtdevices.rst @@ -95,4 +95,4 @@ Vernier Adapter **Example: Using the Surface Temperature Sensor.** - .. literalinclude:: ../../pybricks-projects/snippets/ev3/vernier_surface_temperature/main.py + .. literalinclude:: ../../examples/ev3/vernier_surface_temperature/main.py diff --git a/doc/api/pupdevices.rst b/doc/api/pupdevices.rst index 5bb42cc..7f21d2d 100644 --- a/doc/api/pupdevices.rst +++ b/doc/api/pupdevices.rst @@ -23,17 +23,17 @@ Motors without Rotation Sensors **Example 1: Making the motor move back and forth** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor_dc/motor_dc_init_basic.py + ../../examples/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 + ../../examples/pup/motor_dc/motor_dc_init_direction.py **Example 3: Starting and stopping** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor_dc/motor_dc_stop.py + ../../examples/pup/motor_dc/motor_dc_stop.py .. autoclass:: pybricks._common.DCMotor :noindex: @@ -72,22 +72,22 @@ Motors with Rotation Sensors **Example 1: Making the motor move back and forth** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor/motor_init_basic.py + ../../examples/pup/motor/motor_init_basic.py **Example 2: Using more than one motor** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor/motor_init_multiple.py + ../../examples/pup/motor/motor_init_multiple.py **Example 3: Seting the positive direction as counterclockwise** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor/motor_init_direction.py + ../../examples/pup/motor/motor_init_direction.py **Example 4: Using gears** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor/motor_init_gears.py + ../../examples/pup/motor/motor_init_gears.py .. rubric:: Measuring @@ -97,12 +97,12 @@ Motors with Rotation Sensors **Example 1: Measuring the angle and speed** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor/motor_measure.py + ../../examples/pup/motor/motor_measure.py **Example 2: Resetting the measured angle** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor/motor_reset_angle.py + ../../examples/pup/motor/motor_reset_angle.py .. automethod:: pybricks.pupdevices.Motor.speed @@ -118,7 +118,7 @@ Motors with Rotation Sensors **Example: Stopping the motor in different ways** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor/motor_stop.py + ../../examples/pup/motor/motor_stop.py .. automethod:: pybricks.pupdevices.Motor.stop @@ -134,32 +134,32 @@ Motors with Rotation Sensors **Example 1: Basic usage of all action methods** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor/motor_action_basic.py + ../../examples/pup/motor/motor_action_basic.py **Example 2: Using the** ``then`` **argument to change how a motor stops** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor/motor_action_then.py + ../../examples/pup/motor/motor_action_then.py **Example 3: Using the** ``wait`` **argument to run motors in parallel** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor/motor_action_wait.py + ../../examples/pup/motor/motor_action_wait.py **Example 4: Waiting for two actions to complete in parallel** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor/motor_action_wait_advanced.py + ../../examples/pup/motor/motor_action_wait_advanced.py **Example 5: Running a motor until a mechanical endpoint** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor/motor_until_stalled.py + ../../examples/pup/motor/motor_until_stalled.py **Example 6: Centering a steering mechanism** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor/motor_until_stalled.py + ../../examples/pup/motor/motor_until_stalled.py .. automethod:: pybricks.pupdevices.Motor.run @@ -199,18 +199,18 @@ Color and Distance Sensor **Example 1: Measuring color** .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_color_distance/color_print.py + ../../examples/pup/sensor_color_distance/color_print.py **Example 2: Waiting for a color** .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_color_distance/wait_for_color.py + ../../examples/pup/sensor_color_distance/wait_for_color.py **Example 3: Measuring distance** .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_color_distance/distance_blink.py + ../../examples/pup/sensor_color_distance/distance_blink.py .. autoclass:: pybricks.pupdevices.ColorDistanceSensor :no-members: @@ -231,7 +231,7 @@ Color and Distance Sensor **Example 1: Reading hue, saturation, and value** .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_color_distance/hsv.py + ../../examples/pup/sensor_color_distance/hsv.py **Example 2: Changing the detectable colors** @@ -246,7 +246,7 @@ Color and Distance Sensor even for colors that are otherwise hard to detect. .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_color_distance/detectable_colors.py + ../../examples/pup/sensor_color_distance/detectable_colors.py .. automethod:: pybricks.pupdevices.ColorDistanceSensor.hsv @@ -264,7 +264,7 @@ Color and Distance Sensor **Example: Blinking the built-in light** .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_color_distance/distance_blink.py + ../../examples/pup/sensor_color_distance/distance_blink.py .. automethod:: pybricks.pupdevices::ColorDistanceSensor.light.on @@ -296,13 +296,13 @@ and ambient conditions. **Example 1: Control a Power Functions motor** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor_pf/motor_pf_basics.py + ../../examples/pup/motor_pf/motor_pf_basics.py **Example 2: Controlling multiple Power Functions motors** .. literalinclude:: - ../../pybricks-projects/snippets/pup/motor_pf/motor_pf_pwm.py + ../../examples/pup/motor_pf/motor_pf_pwm.py .. autoclass:: pybricks.pupdevices.PFMotor :noindex: @@ -331,13 +331,13 @@ Color Sensor **Example 1: Measuring color and reflection** .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_color/color_print.py + ../../examples/pup/sensor_color/color_print.py **Example 2: Waiting for a color** .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_color/wait_for_color.py + ../../examples/pup/sensor_color/wait_for_color.py .. autoclass:: pybricks.pupdevices.ColorSensor :no-members: @@ -356,7 +356,7 @@ Color Sensor **Example 1: Reading hue, saturation, and value** .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_color/hsv.py + ../../examples/pup/sensor_color/hsv.py **Example 2: Changing the detectable colors** @@ -371,12 +371,12 @@ Color Sensor even for colors that are otherwise hard to detect. .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_color/detectable_colors.py + ../../examples/pup/sensor_color/detectable_colors.py **Example 3: Reading ambient hue, saturation, value, and color** .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_color/color_ambient.py + ../../examples/pup/sensor_color/color_ambient.py .. automethod:: pybricks.pupdevices.ColorSensor.hsv @@ -394,7 +394,7 @@ Color Sensor **Example: Blinking the built-in lights** .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_color/lights_blink.py + ../../examples/pup/sensor_color/lights_blink.py .. automethod:: pybricks.pupdevices::ColorSensor.lights.on @@ -413,12 +413,12 @@ Ultrasonic Sensor **Example 1: Measuring distance and switching on the lights** .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_ultrasonic/basics.py + ../../examples/pup/sensor_ultrasonic/basics.py **Example 2: Using math to gradually change the brightness of the lights** .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_ultrasonic/math.py + ../../examples/pup/sensor_ultrasonic/math.py .. autoclass:: pybricks.pupdevices.UltrasonicSensor :no-members: @@ -449,13 +449,13 @@ Force Sensor **Example 1: Measuring force and movement** .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_force/basics.py + ../../examples/pup/sensor_force/basics.py **Example 2: Measuring peak force** .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_force/peak.py + ../../examples/pup/sensor_force/peak.py .. autoclass:: pybricks.pupdevices.ForceSensor @@ -481,7 +481,7 @@ Infrared Sensor **Example: Measuring distance, object count, and reflection** .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_infrared/basics.py + ../../examples/pup/sensor_infrared/basics.py .. autoclass:: pybricks.pupdevices.InfraredSensor :no-members: @@ -505,7 +505,7 @@ Tilt Sensor **Example: Measuring pitch and roll** .. literalinclude:: - ../../pybricks-projects/snippets/pup/sensor_tilt/basics.py + ../../examples/pup/sensor_tilt/basics.py .. autoclass:: pybricks.pupdevices.TiltSensor :no-members: @@ -543,12 +543,12 @@ Light **Example 1: Making the light blink** .. literalinclude:: - ../../pybricks-projects/snippets/pup/light/basics.py + ../../examples/pup/light/basics.py **Example 2: Using math to gradually change the brightness of the light** .. literalinclude:: - ../../pybricks-projects/snippets/pup/light/math.py + ../../examples/pup/light/math.py .. autoclass:: pybricks.pupdevices.Light :no-members: diff --git a/doc/api/start_ev3_run.inc b/doc/api/start_ev3_run.inc index 6097b68..6c6997f 100644 --- a/doc/api/start_ev3_run.inc +++ b/doc/api/start_ev3_run.inc @@ -142,7 +142,7 @@ as shown in :numref:`fig_firstprogram`. Next, edit *main.py* to make it look like this: .. literalinclude:: - ../../pybricks-projects/snippets/ev3/getting_started/main.py + ../../examples/ev3/getting_started/main.py This program makes your robot beep, rotate the motor, and beep again with a higher pitched tone. Run the program to make sure that it works as expected. diff --git a/doc/api/tools.rst b/doc/api/tools.rst index a911406..fd7bb87 100644 --- a/doc/api/tools.rst +++ b/doc/api/tools.rst @@ -39,7 +39,7 @@ This example shows how to log the angle of a rotating wheel as time passes. - .. literalinclude:: ../../pybricks-projects/snippets/ev3/datalog/main.py + .. literalinclude:: ../../examples/ev3/datalog/main.py In this example, the generated file has the following contents:: @@ -86,4 +86,4 @@ name will always be the same. However, this means that the contents of ``my_file.txt`` will be overwritten every time you run this script. - .. literalinclude:: ../../pybricks-projects/snippets/ev3/datalog_extra/main.py + .. literalinclude:: ../../examples/ev3/datalog_extra/main.py