pimoroni-pico/micropython/examples/motor2040
ZodiusInfuser 6b3ba659a2 Added a reactive encoder example 2022-04-21 21:14:41 +01:00
..
README.md Added a reactive encoder example 2022-04-21 21:14:41 +01:00
current_meter.py
led_rainbow.py
motor_angles.py Added a reactive encoder example 2022-04-21 21:14:41 +01:00
motor_cluster.py Finalised more examples 2022-04-20 18:55:39 +01:00
motor_profiler.py Added attrtuple for capture, and some position control examples 2022-04-20 21:59:20 +01:00
motor_wave.py Finalised more examples 2022-04-20 18:55:39 +01:00
multiple_motors.py Finalised more examples 2022-04-20 18:55:39 +01:00
position_control.py Extended tuning examples to be general control examples 2022-04-21 17:38:37 +01:00
position_on_velocity_control.py Extended tuning examples to be general control examples 2022-04-21 17:38:37 +01:00
position_on_velocity_tuning.py Added PID class and MP tuning examples 2022-04-21 16:47:37 +01:00
position_tuning.py Added PID class and MP tuning examples 2022-04-21 16:47:37 +01:00
reactive_encoder.py Added a reactive encoder example 2022-04-21 21:14:41 +01:00
read_sensors.py
sensor_feedback.py
single_motor.py Finalised more examples 2022-04-20 18:55:39 +01:00
turn_off_led.py
turn_off_motors.py Finalised more examples 2022-04-20 18:55:39 +01:00
velocity_control.py Extended tuning examples to be general control examples 2022-04-21 17:38:37 +01:00
velocity_tuning.py Added PID class and MP tuning examples 2022-04-21 16:47:37 +01:00

README.md

Motor 2040 Micropython Examples

Motor Examples

Single Motor

single_motor.py

Demonstrates how to create a Motor object and control it.

Multiple Motors

multiple_motors.py

Demonstrates how to create multiple Motor objects and control them together.

Motor Cluster

motor_cluster.py

Demonstrates how to create a MotorCluster object to control multiple motors at once.

Motor Wave

motor_wave.py

An example of applying a wave pattern to a group of motors and the LEDs.

Turn Off Motors

turn_off_motors.py

A simple program that turns off the motors.

Encoder Examples

Motor Angles

motor_angles.py

Demonstrates how to read the angles of Motor 2040's four encoders.

Motor Profiler

motor_profiler.py

A program that profiles the speed of a motor across its PWM duty cycle range using the attached encoder for feedback.

Function Examples

Read Sensors

read_sensors.py TODO Shows how to initialise and read the 6 external and 2 internal sensors of Motor 2040.

Sensor Feedback

sensor_feedback.py TODO Show how to read the 6 external sensors and display their values on the neighbouring LEDs.

Current Meter

current_meter.py TODO An example of how to use Motor 2040's current measuring ability and display the value on the onboard LED bar.

LED Rainbow

led_rainbow.py

Displays a rotating rainbow pattern on the Motor 2040's onboard LED.

Turn Off LED

turn_off_led.py

A simple program that turns off the onboard LED.

Control Examples

Position Control

position_control.py

An example of how to move a motor smoothly between random positions, with the help of it's attached encoder and PID control.

Velocity Control

velocity_control.py

An example of how to drive a motor smoothly between random speeds, with the help of it's attached encoder and PID control.

Position on Velocity Control

position_on_velocity_control.py

An example of how to move a motor smoothly between random positions, with velocity limits, with the help of it's attached encoder and PID control.

Reactive Encoder

reactive_encoder.py

A demonstration of how a motor with an encoder can be used as a programmable rotary encoder for user input, with force-feedback for arbitrary detents and end stops.

Tuning Examples

Position Tuning

position_tuning.py

A program to aid in the discovery and tuning of motor PID values for position control. It does this by commanding the motor to move repeatedly between two target angles and plots the measured response.

Velocity Tuning

velocity_tuning.py

A program to aid in the discovery and tuning of motor PID values for velocity control. It does this by commanding the motor to drive repeatedly between two target speeds and plots the measured response.

Position on Velocity Tuning

position_on_velocity_tuning.py

A program to aid in the discovery and tuning of motor PID values for position on velocity control. It does this by commanding the motor to move repeatedly between two target angles and plots the measured response.