Library for generating servo pulses from mbed output pins

Dependents:   mbed_ES20X_Tester MadPulseCntrl ES413Integration Emaxx_Navigation ... more

Fork of SERVOGEN by Joseph Bradshaw

ServoOut Library

Assign the ServoOut object (output pin) a value in microseconds to change the servo pulse. Note that the default range is between 900 and 2100 microseconds.

Library for generating servo pulses using the Ticker class

/media/uploads/jebradshaw/mbedwsesbc_servos.jpg

/media/uploads/jebradshaw/mbed_servo_pulses.jpg

include the mbed library with this snippet

// ServoOut Class test program
// J. Bradshaw 20140925
#include "mbed.h"
#include "ServoOut.h" 
 
ServoOut servo1(p21);
ServoOut servo2(p24);
DigitalOut led1(LED1);
 
int main() {
    servo1.pulse_us = 0;        
    // spin in a main loop. flipper will interrupt it to call flip
    while(1) {
        for(float cycle=0.0;cycle<2.0*3.14159;cycle+=.003){
            //small amplitude sine wave on servo1
            servo1 = 300 * sin(cycle) + 1500;            
            //ramp up the second servo2 channel relative to cycle
            servo2 = 1000 + cycle*159; // .001/(2*PI)
            
            wait(.001); //short delay
        }
        led1 = !led1;   //toggle led1 to indicate activity
    }//while(1)
}//main

History

ServoOut - First revision (renamed from SERVOGEN) of ServoOut library to generate servo pulses from mbed output pins. default tip

2015-04-10, by jebradshaw [Fri, 10 Apr 2015 17:08:12 +0000] rev 6

ServoOut - First revision (renamed from SERVOGEN) of ServoOut library to generate servo pulses from mbed output pins.


ServoOut - library for generating servo output pulses using the Ticker class

2015-04-10, by jebradshaw [Fri, 10 Apr 2015 17:07:00 +0000] rev 5

ServoOut - library for generating servo output pulses using the Ticker class


Servo Pulse Generator Object Library

2015-04-09, by jebradshaw [Thu, 09 Apr 2015 20:49:29 +0000] rev 4

Servo Pulse Generator Object Library


Added operator accessible read/writes to simplify use; J Bradshaw 20140929

2014-09-29, by jebradshaw [Mon, 29 Sep 2014 16:47:31 +0000] rev 3

Added operator accessible read/writes to simplify use; J Bradshaw 20140929


updated on 20140928

2014-09-28, by jebradshaw [Sun, 28 Sep 2014 18:57:11 +0000] rev 2

updated on 20140928


Servo pulse generation library; v1.0

2014-09-26, by jebradshaw [Fri, 26 Sep 2014 19:47:23 +0000] rev 1

Servo pulse generation library; v1.0


J. Bradshaw 20140926; Working servo pulse generation library using Ticker class.

2014-09-26, by jebradshaw [Fri, 26 Sep 2014 19:22:18 +0000] rev 0

J. Bradshaw 20140926; Working servo pulse generation library using Ticker class.