中継機能つけた受け取りオムニ

Dependencies:   mbed MultiSerial

Revision:
23:54fddee73c88
Parent:
22:bfeb1c6e2539
Child:
24:37a17b7c6201
Child:
25:a6e41d2efd0c
--- a/main.cpp	Wed Oct 01 09:18:03 2014 +0000
+++ b/main.cpp	Fri Oct 03 10:45:48 2014 +0000
@@ -126,7 +126,7 @@
         pwm[2] = i;
         pwm[3] = i;
 
-        wait(count*2*10e-3); //count value * 0.01 sec
+        //wait_ms(1.0); //count value * 0.01 sec
     
     //check = 0;
 }
@@ -154,36 +154,43 @@
 
     for(;;) {
 
-        wait_ms(1.0);
+        wait_ms(0.5);
 
         //memcpy(&packet, get_data, DATA_NUM);
         packet.arm[0] = get_data[1];
         packet.leg = get_data[0];
 
-        check = get_data[1];
+        //check = get_data[1];
         
+        check = 0xFF;
+        if(packet.leg!=0){
+            
+            check = packet.leg;
+            }
 
         /* Stop */
     if(packet.leg==0x0) {
-
-            if(counter!=0){
+            
+            for(;counter>=0;counter--){
                 
-                move_slowly(counter);
-                
-                counter--;
-            } //cunter init
+            //if(counter>=0){counter--;} //cunter init
+            
+            move_slowly(counter);
+            wait_ms(0.1);
+            
+            }           
 
-
-            motors = 0;
-            
+        }else{
 
-        } else {
-
-            if(counter<=10e3){counter++;}
+            if(counter<=10e3){
+                counter++;
+            }
+                
+            move_slowly(counter);
     }
 
         /* PWM */
-        if((packet.leg>>4)==0) {
+        /*if((packet.leg>>4)==0) {
 
             pwm[0] = PWM_L;
             pwm[1] = PWM_R;
@@ -198,6 +205,7 @@
             pwm[3] = PWM;
             
         }
+        */
 
         /* Direction of movement */
         if(packet.leg&R) motors = 0x55; //01010101 R 接続に気をつけること