Program used to control a quadcopter. It uses a PID library which can be found in: http://developer.mbed.org/cookbook/PID I also uses my own written library for easily controlling quadcopter motors, which can be found in: https://developer.mbed.org/users/moklumbys/code/Quadcopter/ One more library that I used is MPU6050 that was previously written by Erik Olieman but I was able to update it with new functions: https://developer.mbed.org/users/moklumbys/code/MPU6050/

Dependencies:   MPU6050 PID Quadcopter Servo mbed

Revision:
5:8b3f82abe3a4
Parent:
4:eb418af66d81
Child:
6:5e815d4b4d8f
--- a/main.cpp	Thu Feb 19 23:30:15 2015 +0000
+++ b/main.cpp	Fri Feb 20 00:52:54 2015 +0000
@@ -67,7 +67,6 @@
     float gyroOffset[3];
     float angle[3];     //total calculated angle
 
-    float currTime;     //current time variable will be given in the funtion
     float prevTime;     //previous time values will be given in the function 
     
     if (mpu.testConnection())   //just testing if things are working...
@@ -108,9 +107,7 @@
 //        quad.run (speed);
 //-------------------------------------------START INFINITE LOOP-------------------------------------------------
     while(1) {
-            currTime = timer.read();                                                //get present time
-            
-            mpu.computeAngle (angle, accOffset, gyroOffset, &currTime, &prevTime);  // get angle using all these values
+            mpu.computeAngle (angle, accOffset, gyroOffset, timer.read()-prevTime);  // get angle using all these values
             
             rollPID.setInterval(timer.read()-prevTime);         //need to change the interval because don't know how much time passed
             pitchPID.setInterval(timer.read()-prevTime);