59019ab850 | ||
---|---|---|
.. | ||
README.md | ||
led_rainbow.py | ||
motor_cluster.py | ||
motor_profiler.py | ||
motor_wave.py | ||
multiple_motors.py | ||
position_control.py | ||
position_on_velocity_control.py | ||
position_on_velocity_tuning.py | ||
position_tuning.py | ||
quad_position_wave.py | ||
quad_velocity_sequence.py | ||
reactive_encoder.py | ||
read_encoders.py | ||
read_sensors.py | ||
single_motor.py | ||
stop_motors.py | ||
turn_off_led.py | ||
velocity_control.py | ||
velocity_tuning.py |
README.md
Motor 2040 Micropython Examples
Motor Examples
Single Motor
Demonstrates how to create a Motor object and control it.
Multiple Motors
Demonstrates how to create multiple Motor objects and control them together.
Motor Cluster
Demonstrates how to create a MotorCluster object to control multiple motors at once.
Motor Wave
An example of applying a wave pattern to a group of motors and the LEDs.
Stop Motors
A simple program that stops the motors.
Function Examples
Read Sensors
Shows how to initialise and read the 2 external and 6 internal sensors of Motor 2040.
Read Encoders
Demonstrates how to read the angles of Motor 2040's four encoders.
Motor Profiler
A program that profiles the speed of a motor across its PWM duty cycle range using the attached encoder for feedback.
LED Rainbow
Displays a rotating rainbow pattern on the Motor 2040's onboard LED.
Turn Off LED
A simple program that turns off the onboard LED.
Control Examples
Position Control
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
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
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.
Quad Position Wave
A demonstration of driving all four of Motor 2040's motor outputs between positions, with the help of their attached encoders and PID control.
Quad Velocity Sequence
A demonstration of driving all four of Motor 2040's motor outputs through a sequence of velocities, with the help of their attached encoders and PID control.
Tuning Examples
Position Tuning
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 setpoint angles and plots the measured response.
Velocity Tuning
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 setpoint 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 setpoint angles and plots the measured response.