cansat program1

Dependencies:   ADXL345 BME280 HMC5883L ITG3200 MBed_Adafruit-GPS-Library XBee agzIDLIST cansat mbed

Fork of Cansat_program4_1 by CanSat2015aizu

Files at this revision

API Documentation at this revision

Comitter:
s1200058
Date:
Fri Aug 14 04:56:21 2015 +0000
Parent:
19:cb3a4b4c3526
Child:
21:18a196d3021c
Commit message:
test

Changed in this revision

HMC5883L.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/HMC5883L.lib	Thu Aug 13 07:11:57 2015 +0000
+++ b/HMC5883L.lib	Fri Aug 14 04:56:21 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/xeta05/code/HMC5883L/#c9ce1eeaf001
+https://developer.mbed.org/teams/CanSat2015aizu/code/HMC5883L/#f9836a4caacf
--- a/main.cpp	Thu Aug 13 07:11:57 2015 +0000
+++ b/main.cpp	Fri Aug 14 04:56:21 2015 +0000
@@ -69,9 +69,9 @@
  int running_flag = 0;
 
 Timer compass_Timer;
-const int compass_Time = 500;
+const int compass_Time = 50;
 Timer running_Timer;
-const int running_Time = 500;
+const int running_Time = 50;
 Timer parachute_Timer;
 const int parachute_Time = 30000;
 /////////////////////////////////////////
@@ -90,8 +90,8 @@
 double preHeading = 0.0;
  
 int maxX, minX, maxY, minY;
-const int ofsX = 36;                   //calibration x
-const int ofsY = -425;                   //calibration y
+const int ofsX = -102;                   //calibration x
+const int ofsY = -381;                   //calibration y
 
     int16_t raw[3]; 
 
@@ -216,29 +216,21 @@
     if(t==r) {
         //前進
         return 'f';
-    } else if(n < 4) {
+    } else if(n == 4) {
+        return 'r';
+    } else if(n > 0 && n < 4) {
         if(t > r)
-            t -= 8;
+            return 'r';
         else
-            r -= 8; 
-            
-        if(r-t > 0)
+            return 'l';
+    } else if(n > 4 && n < 8){
+        if(t > r)
             return 'l';
         else
             return 'r';
-    } else if(n >= 4) {
-        if(t > r)
-            t -= 8;
-        else
-            r -= 8; 
-            
-        if(r-t > 0)
-            return 'r';
-        else
-            return 'l';
-    }
+    } else
+        return 'b';
     
-    return 'b';
 }
 
 //対象とロボットの角度