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.cpp
- Revision:
- 7:18a57f597ec4
- Parent:
- 6:1d8357775b6d
- Child:
- 8:c952ac46bd39
diff -r 1d8357775b6d -r 18a57f597ec4 Maestro.cpp --- a/Maestro.cpp Mon Jan 06 13:16:37 2014 +0000 +++ b/Maestro.cpp Mon Jan 06 16:45:21 2014 +0000 @@ -9,7 +9,7 @@ #include "Maestro.h" -Maestro::Maestro(PinName tx, PinName rx) : serial(tx, rx), pc(USBTX, USBRX) +Maestro::Maestro(PinName tx, PinName rx) : serial(tx, rx) { serial.format(8, SerialBase::None, 1); //8N1 } @@ -105,4 +105,4 @@ void Maestro::goHome() { serial.putc(GO_HOME); -} \ No newline at end of file +}