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.
A demonstration of driving both of Inventor 2040 W's motor outputs through a sequence of velocities, with the help of their attached encoders and PID control.
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.
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.
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.
## Servo Examples
### Single Servo
[servos/single_servo.py](servos/single_servo.py)
Demonstrates how to control a single servo on Inventor 2040 W.
An example of how to move a servo smoothly between random positions.
### Servo Wave
[servos/servo_wave.py](servos/servo_wave.py)
An example of applying a wave pattern to a group of servos and the LEDs.
### Calibration
[servos/calibration.py](servos/calibration.py)
Shows how to configure Inventor 2040 W's servos with different common calibrations, as well as a completely custom one.
## Audio Examples
### Tone Song
[audio/tone_song.py](audio/tone_song.py)
This example shows you how you can use Inventor 2040 W's audio output with a speaker to play different notes and string them together into a bleepy tune.
### Motor Song
[audio/motor_song.py](audio/motor_song.py)
A fun example of how to change a motor's frequency to have it play a song.