Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MadPulseCntrl Emaxx_Navigation Emaxx_Navigation_Dynamic_HIL Madpulse_Speed_Control_temp ... more
You are viewing an older revision! See the latest version
Homepage
ServoIn Class Library for reading hobby servo pulses on digital input pins¶
This class library uses external interrupts with timer functions to read servos pulses on mbed input pins.
include the mbed library with this snippet
#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());
}
}