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

Dependencies:   mbed MultiSerial

Revision:
26:9a7e9dd2746f
Parent:
25:a6e41d2efd0c
Child:
27:68f76ea992bd
Child:
32:33078ddc3bcb
--- a/main.cpp	Sun Oct 05 08:21:35 2014 +0000
+++ b/main.cpp	Tue Oct 07 08:01:29 2014 +0000
@@ -19,7 +19,7 @@
 #define XBEE_KEY 0xAA //keycode
 #define ARM_KEY 0xAA
 
-#define PWM 0.3
+#define PWM 0.5
 #define PWM_SLOW 0.1
 
 
@@ -59,77 +59,6 @@
 
 uint8_t check_data[2]={0};
 
-int counter=0;
-
-
-/* Out put PC stdout function */
-void pc_print()
-{
-    static int count=0;
-
-    if(count==10e3) {
-        pc.printf(" arm = %d" ,packet.arm[0]);
-        pc.printf(" leg = %d" ,packet.leg);
-        count=0;
-    }
-    count++;
-}
-
-uint8_t readable_ratio(){
-    
-    int check = 0;
-    
-    for(int i=0;i>=100;i++){
-        
-        if(xbee.readable_check()==1){check++;}
-        
-        wait_ms(1.0);
-        }
-    return check;
-    }
-
-void connect_check(void)
-{
-    xbee.start_read();
-    xbee.read_data(check_data,XBEE_KEY);
-    
-    check = 0x01;    
-    
-    while(readable_ratio()>=50);
-    
-    check = 0x03;
-    
-    while(readable_ratio()<=50);
-
-    check = 0x07;
-    
-    xbee.stop_read();
-    xbee.start_write();
-
-    check_data[0]=0xCC;
-
-    xbee.write_data(check_data,XBEE_KEY);
-
-    wait_ms(10);
-
-    xbee.stop_write();
-}
-
-void move_slowly(int count)
-{   
-
-        float i=(count/10e3)*PWM; //mirisec -->> sec
-
-        pwm[0] = i;
-        pwm[1] = i;
-        pwm[2] = i;
-        pwm[3] = i;
-
-        //wait_ms(1.0); //count value * 0.01 sec
-    
-    //check = 0;
-}
-
 int main()
 {
 
@@ -149,8 +78,6 @@
     armMbed.start_write();
     armMbed.write_data(pt_packet->arm,ARM_KEY);
     
-    counter=0;
-
     check = 0xFF;
     wait(0.5);
 
@@ -177,42 +104,14 @@
         pwm[1] = 0;
         pwm[2] = 0;
         pwm[3] = 0;  
-        
-        /*
-            for(;counter>=0;counter--){
                 
-            //if(counter>=0){counter--;} //cunter init
-            
-            //move_slowly(counter);
-            //wait_ms(0.1);
-            
-            }
-            */           
 
         }else{
-            
-        /*
-            if(counter<=10e3){
-                counter++;
-            }
-                
-           move_slowly(counter);
-         */
-         
-         if((packet.leg==L_U) || (packet.leg==L_D)){
-            
-            pwm[0] = PWM_SLOW;
-            pwm[1] = PWM_SLOW;
-            pwm[2] = PWM_SLOW;
-            pwm[3] = PWM_SLOW;
-            
-            }else{
                            
             pwm[0] = PWM;
             pwm[1] = PWM;
             pwm[2] = PWM;
             pwm[3] = PWM;
-           }
     }
 
 
@@ -246,7 +145,5 @@
         if(packet.leg&L_R) motors = 0x99; //10011001
         //if(packet.leg&L_U) 
         //if(packet.leg&L_D)
-            
-        pc_print();
     }
 }
\ No newline at end of file