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

Files at this revision

API Documentation at this revision

Comitter:
moklumbys
Date:
Sun Mar 01 22:53:30 2015 +0000
Parent:
8:56bdb0d7002b
Commit message:
finished with BT.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Mar 01 22:45:31 2015 +0000
+++ b/main.cpp	Sun Mar 01 22:53:30 2015 +0000
@@ -83,18 +83,21 @@
     
     quad.setLimits(MIN_CALIBRATE, MAX_CALIBRATE);   //set calibration limits for the system
     
+    pc.printf ("Send c to calibrate and s to skip calibration.\n");
     while(1){
         if (!bt.readable()){
             if (!bt.scanf("%f", &val)){
                 bt.scanf("%c", &buff);
             } else {
+                if (val == 's'){
+                    pc.printf ("Skipping calibration.\n");
+                    break;  
+                }               
                 if (val == 'c'){
                     pc.printf ("Calibrating motors.\n");
                     quad.calibrate();   //calibrating motors  
-                }
-                if (val == 's'){
-                    pc.printf ("Skipping calibration.\n");
-                    break;  
+                } else {
+                    pc.printf ("Are you sure that you sent c/s?\n");     
                 }
             }
         }   
@@ -135,9 +138,9 @@
                     pitchPID.setTunings(val, 0.0, 0.0);
                     rollPID.setTunings(val, 0.0, 0.0);  
                     pc.printf ("______________________SET______________________\n"); 
-                }             
-        }
-            
+            }             
+         }
+               
             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