NHK2019ROBOCON team A manual robot program 10/4 version (ロボコン当日使用プログラム)

Dependencies:   mbed 2019ROBOKONmanualProgram

Revision:
6:2675289c6463
Parent:
5:1548821bebf3
Child:
7:59b18749a41b
--- a/main.cpp	Sat Oct 05 09:04:33 2019 +0000
+++ b/main.cpp	Sun Oct 06 00:48:42 2019 +0000
@@ -88,6 +88,7 @@
 int old_cross=0;
 int r=6;
 int s=5;
+bool x=0;
 
 
 //関数プロトタイプ宣言
@@ -657,7 +658,20 @@
     if(square!=old_square) {
         old_square=square;
         if(square==1&&select==0) {
-            
+            if(x==0){
+                data_servo=0x07;
+                send_data(0x18,data_servo);
+                wait(1.2);
+                data7=0x00;
+                get_data_rs232=get_data_rs232 & 0b11101111;
+                while(!(get_data_rs232 & 0x10)){
+                    send_data(0x24,data7);
+                    get_data_rs232=slave.getc();
+                }
+                data7=0x10;
+                send_data(0x24,data7);
+                x=1;
+            /*
             data_servo=0x07;
             send_data(0x18,data_servo);
             wait(1.2);
@@ -680,9 +694,23 @@
             }
             data7=0x10;
             send_data(0x24,data7);
+            */
+            }else if(x==1){
+                data_servo=0x08;
+                send_data(0x18,data_servo);
+                wait(1.2);
+                data7=0xff;
+                get_data_rs232=get_data_rs232 & 0b11011111;
+                while(!(get_data_rs232 & 0x20)){
+                    send_data(0x24,data7);
+                    get_data_rs232=slave.getc();
+                }
+                data7=0x10;
+                send_data(0x24,data7);
+                x=0;
             
             }
-        }else if(triangle!=old_triangle){
+        }/*else if(triangle!=old_triangle){
             if(triangle==1&&select==0){
                                 
                 data_servo=0x07;
@@ -704,7 +732,7 @@
                 }
                 data7=0x10;
                 send_data(0x24,data7);
-            }
+            }*/
         }
     }
 }