Kiko Ishimoto / Mbed 2 deprecated sotuken_mother_2

Dependencies:   ds3_si mbed omuni solenoid

Fork of 2017_Robocon_mother by gaku takasawa

Revision:
8:030080071a4a
Parent:
7:c24e61f00404
Child:
9:8fd838e5a0a1
diff -r c24e61f00404 -r 030080071a4a main.cpp
--- a/main.cpp	Mon Oct 16 11:12:46 2017 +0000
+++ b/main.cpp	Wed Oct 25 08:53:38 2017 +0000
@@ -2,7 +2,7 @@
 #include "omuni.h"
 #include "solenoid.h"
 
-//#define DEBUG
+#define DEBUG 0
 
 #define CON_OFFSET 15
 
@@ -16,19 +16,21 @@
 
 BusOut serialsel(p19,p20,LED1,LED2);
 Timer serialtimer;
-Ticker readtimer;
+//Ticker readtimer;
 
 char ConData[2][12];
 char offset[4];
 
+/*
 void mbedreset()
 {
     NVIC_SystemReset();
 }
+*/
 
 void GetData()
 {
-    readtimer.attach(&mbedreset, 1);
+    //readtimer.attach(&mbedreset, 1);
     static bool main_flag = 1 ;
     if ( con.getc() == 'H' ) {
          ConData[0][0] = 'H';
@@ -52,24 +54,27 @@
         }
         if(main_flag)
         {
+            /*
+            
             offset[0] = ConData[0][1];
             offset[1] = ConData[0][2];
             offset[2] = ConData[1][1];
             offset[3] = ConData[1][2];
+            */
             serialtimer.start();
             main_flag = 0;
         }
-        ConData[0][1] -= offset[0];
-        ConData[0][2] -= offset[1];
-        ConData[1][1] -= offset[2];
-        ConData[1][2] -= offset[3];
+        //ConData[0][1] -= offset[0];
+        //ConData[0][2] -= offset[1];
+        //ConData[1][1] -= offset[2];
+        //ConData[1][2] -= offset[3];
         
         if( (char)255 - CON_OFFSET < ConData[1][1] || ConData[1][1] < CON_OFFSET)
             ConData[1][1] = 0;
             
         serialtimer.reset();
     }
-    readtimer.detach();
+    //readtimer.detach();
 }
 
 
@@ -83,10 +88,7 @@
         serialtimer.stop();
         serialtimer.reset();
         
-        pc.printf("start\n\n\n\n");
-        
         while(1){
-            
             char MotorData[] = {'H', ConData[0][1], ConData[0][2], ConData[1][1], ConData[1][2]};
             omu.out(MotorData);
 
@@ -97,9 +99,11 @@
             {
                 serialsel = ~serialsel;
                 serialtimer.reset();
+                char MotorReset[] = {'H', 0, 0, 0, 0};
+                omu.out(MotorReset);
             }
 
-            #ifdef DEBUG 
+            #if DEBUG 
             for(int i = 0; i < 12; i++)
             {
                     pc.printf("%3d ",ConData[0][i]);