Library for Pololu Maestro Servo Controller http://www.pololu.com/docs/0J40
Library for Pololu Maestro Servo Controller
Library docs: https://developer.mbed.org/users/kochansky/code/Maestro/docs/f374c7b60318/classMaestro.html
Example usage:
#include "mbed.h" #include "Maestro.h" Maestro maestro(PTC4,PTC3); int main() { maestro.setBaudRate(9600); // limit speed for each servo for (uint8_t i = 0; i < 17; i++) { maestro.setSpeed(i, 10); } while (true) { // set servo on channel 0 to 90 degrees maestro.setServoAngle(0, 90); wait(2); // set servo on channel 0 to 45 degrees maestro.setServoAngle(0, 45); wait(2); } }
Serial commands based on manual: http://www.pololu.com/docs/0J40/5.e
Device pinout:
Diff: Maestro.h
- Revision:
- 4:ef4d23c023ea
- Parent:
- 3:1c654893354d
- Child:
- 5:0fd491357750
diff -r 1c654893354d -r ef4d23c023ea Maestro.h --- a/Maestro.h Sun Jan 05 16:46:14 2014 +0000 +++ b/Maestro.h Sun Jan 05 17:24:40 2014 +0000 @@ -42,7 +42,12 @@ */ Maestro(PinName tx, PinName rx); - void init(); + /** + * Sets baud rate + * + * @param baud - Baud Rate to be set + */ + void setBaudRate(uint16_t baud); /** * Sets the target of a channel to a specified value @@ -52,6 +57,14 @@ */ void setTarget(uint8_t channel, uint16_t target); + /** + * Sets specified channel's servo to a specified angle + * + * @param channel - number a servo channel + * @param angle - target angle of a servo + */ + void setServoAngle(uint8_t channel, int8_t angle); + //void setMultipleTargets(int* channels, int* targets); /**