ARLISS2012

Dependencies:   mbed-rtos mbed MMA7361L MPL115A2

Fork of rtos_basic by mbed official

Revision:
5:31bafc5b1bcd
Parent:
4:4faccc542b32
Child:
6:c97217c9191b
--- a/main.cpp	Thu Aug 30 08:52:03 2012 +0000
+++ b/main.cpp	Thu Aug 30 09:37:06 2012 +0000
@@ -109,19 +109,19 @@
                     float accelZ = accelz_buff / at;                                                               //    <avarage data(end)
                     float lx = illu * 3.3 / 3 * 1000;
 
-                    end = timer.read_us();
-                    double timers_2 = (end - begin) / 1000000;
+                    end = timer.read_us() - timer_count*2000;
+                    double timers = (end - begin ) / 1000000;
 
-                    if(timers_2 > 2000) {
+                    if(timers > 2000) {
                         timer_count ++;
-                        begin = timer.read_us(); //timer number read
+                        begin = timer.read_us() - timer_count*2000;; //timer number read
+                        timers = (end - begin) / 1000000;
                     }
 
-                    double timers = (end - begin) / 1000000;
 
                     if(xbee_count > 6) {
                         double stop_timer = (end - begin_1) / 1000000;
-                        if(stop_timer > 1800) {
+                        if(stop_timer > 30) {
                             fclose(fp);
                             timer.stop();
                             gps_flag = 0;
@@ -139,7 +139,7 @@
 
                         if(xbee_count > 5) {
                             xbee_flag = true;
-                            if(xbee_count == 5) {
+                            if(xbee_count == 6) {
                                 begin_1 = timer.read_us();
                                 break;
                             }