My fully self designed first stable working Quadrocopter Software.

Dependencies:   mbed

Dependents:   fluy343

/media/uploads/maetugr/dsc09031.jpg

Servo_PWM/Servo_PWM.h

Committer:
maetugr
Date:
2015-08-31
Revision:
10:14390c90c3f5
Parent:
5:06e978fd147a

File content as of revision 10:14390c90c3f5:

// by MaEtUgR

#ifndef SERVO_PWM_H
#define SERVO_PWM_H

#include "mbed.h"

/** Class to control a servo by using PWM
 */

class Servo_PWM {

public:
    /** Create a new Servo object on any PWM pin
     *
     * @param Pin Pin on mbed to connect servo to
     */
    Servo_PWM(PinName Pin, int frequency);
    
    void SetFrequency(int frequency);
    
    /** Change the position of the servo. Position in us
     *
     * @param position The new value of the servos position between 0 and 1000 (gets 1000-2000) (us)
     */
    void SetPosition(int position);
    
    /** Operator for confortable positioning
     *
     * @param position see SetPosition
     */
    void operator=(int position);

private:
    PwmOut ServoPin;
    
};

#endif