A library used for controlling a quadcopter. It provides an easy to use interface, which allows to mount, calibrate and run motors. It is also able to calibrate the actual speed according to calculated PID roll & pitch difference. I used the original Servo library as ESC modules use the same PWM signal as Servo motors.

Dependents:   QuadcopterProgram

Revision:
8:0e9474cce85b
Parent:
3:84d246dccb8d
Child:
9:22c52af13ac2
--- a/Quadcopter.cpp	Fri Feb 20 00:51:21 2015 +0000
+++ b/Quadcopter.cpp	Fri Feb 20 01:22:20 2015 +0000
@@ -43,7 +43,12 @@
 void Quadcopter::run (float* speed){
     //simply map values in the correct range and run PWM signals for each motor
     for (int i = 0; i < 4; i++){
-        *motor[i] = this->map(speed[i], 0.0, 1.0, min_calibrate, max_calibrate);
+        if (speed[i] < 0.0)
+            *motor[i] = min.calibrate;
+        else if (speed[i] > 1.0)
+            *motor[i] = max_calibrate;
+        else
+            *motor[i] = this->map(speed[i], 0.0, 1.0, min_calibrate, max_calibrate);
     }
 }
 //-----------------------------Mapping function-----------------------------