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:

/media/uploads/kochansky/maestro.jpg

Files at this revision

API Documentation at this revision

Comitter:
kochansky
Date:
Tue Aug 26 20:07:47 2014 +0000
Parent:
9:a15ea85b40ca
Commit message:
bug fix

Changed in this revision

Maestro.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Maestro.cpp	Mon Aug 25 19:22:10 2014 +0000
+++ b/Maestro.cpp	Tue Aug 26 20:07:47 2014 +0000
@@ -87,7 +87,7 @@
 void Maestro::setSpeed(uint16_t speed)
 {
     for (uint8_t i = 0; i < 18; i++) {
-        setSpeed(speed);
+        setSpeed(i, speed);
     }
 }
 
@@ -102,7 +102,7 @@
 void Maestro::setAcceleration(uint16_t acceleration)
 {
     for (uint8_t i = 0; i < 18; i++) {
-        setAcceleration(acceleration);
+        setAcceleration(i, acceleration);
     }
 }