Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MPU6050 PID Quadcopter Servo mbed
Revision 9:588b1618c710, committed 2015-03-01
- 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