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

Revision:
8:c952ac46bd39
Parent:
7:18a57f597ec4
Child:
9:a15ea85b40ca
--- a/Maestro.h	Mon Jan 06 16:45:21 2014 +0000
+++ b/Maestro.h	Tue Jan 07 18:35:25 2014 +0000
@@ -1,5 +1,24 @@
 /**
- * @author Przemysław Kochański
+ * @author Przemyslaw Kochanski <przemyslaw@kochanski.biz>
+ *
+ * @Section LICENSE
+ *
+ * Copyright (C) 2014 Przemyslaw Kochanski, MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  * @section DESCRIPTION
  *
@@ -88,13 +107,21 @@
      */
     void setMultipleTargets(uint8_t firstChannel, uint8_t count, uint16_t* targets);
 
+    /**
+     * Simultaneously sets specified contiguous block of servo channels to a specified angles
+     *
+     * @param count - number of servo channels in the contiguous block
+     * @param firstChannel - lowest servo channel number in the contiguous block
+     * @param angles - target values (the pulse width to transmit in units of
+     *  quarter-microseconds) for each of the servo channels, in order by channel number
+     */
     void setServosAngles(uint8_t firstChannel, uint8_t count, int8_t* angles);
 
     /**
      * Limits the speed at which a servo channel's output value changes
      *
      * @param channel - number of a servo channel
-     * @param speed - speed of the servo in units of 0.25 μs / (10 ms)
+     * @param speed - speed of the servo in units of 0.25 us / (10 ms)
      */
     void setSpeed(uint8_t channel, uint16_t speed);
 
@@ -102,7 +129,7 @@
      * Limits the acceleration of a servo channel's output
      *
      * @param channel - number of a servo channel
-     * @param acceleration - acceleration of the servo in units of (0.25 μs) / (10 ms) / (80 ms)
+     * @param acceleration - acceleration of the servo in units of (0.25 us) / (10 ms) / (80 ms)
      */
     void setAcceleration(uint8_t channel, uint16_t acceleration);
 
@@ -110,8 +137,8 @@
      * Sets the PWM output to the specified on time and period
      *
      * @param channel - number of a servo channel
-     * @param time - time in units of 1/48 μs
-     * @param period - period in units of 1/48 μs
+     * @param time - time in units of 1/48 us
+     * @param period - period in units of 1/48 us
      */
     void setPWM(uint8_t channel, uint16_t time, uint16_t period);