Class Library for reading hobby servos and detecting invalid or disconnected channels

Dependents:   MadPulseCntrl Emaxx_Navigation Emaxx_Navigation_Dynamic_HIL Madpulse_Speed_Control_temp ... more

ServoIn Class Library

This class library uses external interrupts with timer functions to read servos pulses on mbed input pins.

ServoIn Library usage example

#include "mbed.h"
#include "ServoIn.h"

DigitalOut led1(LED1);
ServoIn servoIn1(p15);
ServoIn servoIn2(p14);
Serial pc(USBTX, USBRX); // tx, rx

int main() {    
    pc.baud(921600);            //Fast baud rate
        
    while(1) {
        led1 = 1;
        wait(0.05);
        led1 = 0;
        wait(0.05);
        
        pc.printf("servo pulse: CH1=%5dus  CH2=%5dus\r\n", servoIn1.read(), servoIn2.read());        
    }
}

History

added check for valid servo pulse when greater then servo max to prevent flag check after pulse interrupt (inverted pulse measure phase) default tip

2017-08-14, by jebradshaw [Mon, 14 Aug 2017 14:51:20 +0000] rev 5

added check for valid servo pulse when greater then servo max to prevent flag check after pulse interrupt (inverted pulse measure phase)


Added digital pin and constructor initial state test

2016-08-04, by jebradshaw [Thu, 04 Aug 2016 15:46:31 +0000] rev 4

Added digital pin and constructor initial state test


Tests for reading calibrated pulse within range or returns (float)0.0.

2015-05-21, by jebradshaw [Thu, 21 May 2015 18:40:06 +0000] rev 3

Tests for reading calibrated pulse within range or returns (float)0.0.


Reads servo input pulses using an external interrupt and tiimer function

2015-05-09, by jebradshaw [Sat, 09 May 2015 15:25:03 +0000] rev 2

Reads servo input pulses using an external interrupt and tiimer function


ServoIn Class Library with invalid pulse detection

2015-04-15, by jebradshaw [Wed, 15 Apr 2015 19:36:40 +0000] rev 1

ServoIn Class Library with invalid pulse detection


ServoIn - First class library 20150414; Joe Bradshaw

2015-04-14, by jebradshaw [Tue, 14 Apr 2015 20:05:13 +0000] rev 0

ServoIn - First class library 20150414; Joe Bradshaw