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+

Servo.h

Committer:
jdenkers
Date:
2010-10-17
Revision:
0:30b972d2dcec
Child:
1:352133517ccc

File content as of revision 0:30b972d2dcec:

#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