fasdf gfaha / Servo

Servo.h

Committer:
UCSBRobotics
Date:
2012-08-01
Revision:
2:19f995979c6a
Child:
3:5357104c16a6

File content as of revision 2:19f995979c6a:

#ifndef SERVO_H
#define SERVO_H

#include "mbed.h"



class Servo
{
public:
    Servo(PinName pin, unsigned int width = 1500);
    void write(int width);
    int read();
    void operator=(int width);
    operator int();
    
protected:
    static unsigned int numServos;
    static Servo *servos[];
    static const unsigned int period = 20000;
    static Timeout refreshTimeout;
    Timeout servoTimeout;
    unsigned int pulseWidth;
    DigitalOut signalPin;
    
    static void refresh();
    void timeout();
};

#endif // SERVO_H