NOT FINISHED YET!!! My first try to get a self built fully working Quadrocopter based on an mbed, a self built frame and some other more or less cheap parts.
Servo_PWM/Servo_PWM.cpp
- Committer:
- maetugr
- Date:
- 2012-10-29
- Revision:
- 15:753c5d6a63b3
- Child:
- 21:c2a2e7cbabdd
File content as of revision 15:753c5d6a63b3:
#include "Servo_PWM.h" #include "mbed.h" Servo_PWM::Servo_PWM(PinName Pin) : ServoPin(Pin) { ServoPin.period(0.020); ServoPin = 0; initialize(); // TODO: Works? } void Servo_PWM::initialize() { // initialize ESC SetPosition(1000); // full throttle wait(0.01); // for 0.01 secs SetPosition(1000); // low throttle } void Servo_PWM::SetPosition(int position) { ServoPin.pulsewidth(position/1000000.0); } void Servo_PWM::operator=(int position) { SetPosition(position); }