Both of the robot bodies we will provide for the Roboto workshop use servo motors. That means the first task you have in front of you is to set up the PWM with the proper timing for driving servo motors.
My advice is to first use PWM to dim an LED on the board you have chosen. This gives immediate feedback that you have things working.
From there you must implement the following timing:
- Period of exactly 20ms
- Pulse Widths (the time the pin is high):
- 1ms moves the servo to its limit in one direction
- 2ms moves the servo to its limit in the other direction
- 1.5ms centers the servo motor
In the case of the wheeled robs the 1 and 2 ms widths will move the motors forward or back while the 1.5ms timing will stop the movement.
In the case of the MeARM the settings between 1 and 2ms will position the arm. I suggest writing a function wrapper that can divide up the with into increments of 180 (for positioning in degrees). Moving 1 degree every 15ms results in fairly reliably motion for me.