My fully self designed first stable working Quadrocopter Software.

Dependencies:   mbed

Dependents:   fluy343

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Servo_PWM.h Source File

Servo_PWM.h

00001 // by MaEtUgR
00002 
00003 #ifndef SERVO_PWM_H
00004 #define SERVO_PWM_H
00005 
00006 #include "mbed.h"
00007 
00008 /** Class to control a servo by using PWM
00009  */
00010 
00011 class Servo_PWM {
00012 
00013 public:
00014     /** Create a new Servo object on any PWM pin
00015      *
00016      * @param Pin Pin on mbed to connect servo to
00017      */
00018     Servo_PWM(PinName Pin, int frequency);
00019     
00020     void SetFrequency(int frequency);
00021     
00022     /** Change the position of the servo. Position in us
00023      *
00024      * @param position The new value of the servos position between 0 and 1000 (gets 1000-2000) (us)
00025      */
00026     void SetPosition(int position);
00027     
00028     /** Operator for confortable positioning
00029      *
00030      * @param position see SetPosition
00031      */
00032     void operator=(int position);
00033 
00034 private:
00035     PwmOut ServoPin;
00036     
00037 };
00038 
00039 #endif