Servo library based on Timer instead of PWM. Fork of original https://os.mbed.com/users/jdenkers/code/Servo/ and modified for compatibility with MbedOS6+
Diff: Servo.h
- Revision:
- 0:30b972d2dcec
- Child:
- 1:352133517ccc
diff -r 000000000000 -r 30b972d2dcec Servo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.h Sun Oct 17 13:13:50 2010 +0000 @@ -0,0 +1,24 @@ +#ifndef MBED_SERVO_H +#define MBED_SERVO_H + +#include "mbed.h" + +class Servo { + +public: + Servo(PinName Pin); + void SetPosition(int NewPos); + void Enable(int StartPos, int Period); + void Disable(); + +private: + void StartPulse(); + void EndPulse(); + + int Position; + DigitalOut ServoPin; + Ticker Pulse; + Timeout PulseStop; +}; + +#endif \ No newline at end of file