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.
Servo.cpp
- Committer:
- boro
- Date:
- 2021-03-13
- Revision:
- 2:87ca9b0c9992
File content as of revision 2:87ca9b0c9992:
#include "Servo.h" #include "mbed.h" Servo::Servo(PinName Pin) : ServoPin(Pin) {} void Servo::SetPosition(int Pos) { Position = Pos; } void Servo::StartPulse() { ServoPin = 1; PulseStop.attach_us(callback(this, &Servo::EndPulse), Position); } void Servo::EndPulse() { ServoPin = 0; } void Servo::Enable(int StartPos, int Period) { Position = StartPos; Pulse.attach_us(callback(this, &Servo::StartPulse), Period); } void Servo::Disable() { Pulse.detach(); }