My fully self designed first stable working Quadrocopter Software.

Dependencies:   mbed

Dependents:   fluy343

/media/uploads/maetugr/dsc09031.jpg

Committer:
maetugr
Date:
Mon Sep 02 15:04:22 2013 +0000
Revision:
0:12950aa67f2a
Child:
1:5e2b81f2d0b4
first commit of new version (only one axis for test until now); note: no more Ticker! (made problems because of interrupts)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maetugr 0:12950aa67f2a 1 // by MaEtUgR
maetugr 0:12950aa67f2a 2
maetugr 0:12950aa67f2a 3 #ifndef SERVO_PWM_H
maetugr 0:12950aa67f2a 4 #define SERVO_PWM_H
maetugr 0:12950aa67f2a 5
maetugr 0:12950aa67f2a 6 #include "mbed.h"
maetugr 0:12950aa67f2a 7
maetugr 0:12950aa67f2a 8 /** Class to control a servo by using PWM
maetugr 0:12950aa67f2a 9 */
maetugr 0:12950aa67f2a 10
maetugr 0:12950aa67f2a 11 class Servo_PWM {
maetugr 0:12950aa67f2a 12
maetugr 0:12950aa67f2a 13 public:
maetugr 0:12950aa67f2a 14 /** Create a new Servo object on any PWM pin
maetugr 0:12950aa67f2a 15 *
maetugr 0:12950aa67f2a 16 * @param Pin Pin on mbed to connect servo to
maetugr 0:12950aa67f2a 17 */
maetugr 0:12950aa67f2a 18 Servo_PWM(PinName Pin, int frequency);
maetugr 0:12950aa67f2a 19
maetugr 0:12950aa67f2a 20 void SetFrequency(int frequency);
maetugr 0:12950aa67f2a 21
maetugr 0:12950aa67f2a 22 /** Change the position of the servo. Position in us
maetugr 0:12950aa67f2a 23 *
maetugr 0:12950aa67f2a 24 * @param position The new value of the servos position between 0 and 1000 (gets 1000-2000) (us)
maetugr 0:12950aa67f2a 25 */
maetugr 0:12950aa67f2a 26 void SetPosition(int position);
maetugr 0:12950aa67f2a 27
maetugr 0:12950aa67f2a 28 /** Operator for confortable positioning
maetugr 0:12950aa67f2a 29 *
maetugr 0:12950aa67f2a 30 * @param position see SetPosition
maetugr 0:12950aa67f2a 31 */
maetugr 0:12950aa67f2a 32 void operator=(int position);
maetugr 0:12950aa67f2a 33
maetugr 0:12950aa67f2a 34 /** initialize ESC
maetugr 0:12950aa67f2a 35 */
maetugr 0:12950aa67f2a 36 void initialize();
maetugr 0:12950aa67f2a 37
maetugr 0:12950aa67f2a 38 private:
maetugr 0:12950aa67f2a 39 PwmOut ServoPin;
maetugr 0:12950aa67f2a 40
maetugr 0:12950aa67f2a 41 };
maetugr 0:12950aa67f2a 42
maetugr 0:12950aa67f2a 43 #endif