NHK2019ROBOCON team A manual robot program 10/4 version (ロボコン当日使用プログラム)
Dependencies: mbed 2019ROBOKONmanualProgram
Diff: main.cpp
- Revision:
- 4:ab73021bbce1
- Parent:
- 3:82008ebeb93c
- Child:
- 5:1548821bebf3
--- a/main.cpp Fri Sep 27 23:53:04 2019 +0000 +++ b/main.cpp Fri Oct 04 12:44:52 2019 +0000 @@ -165,6 +165,7 @@ data9=0x80; data10=0x80; data11=0x80; + data_servo=0x00; send_data(0x10,data1); send_data(0x12,data2); @@ -177,6 +178,7 @@ send_data(0x28,data9); send_data(0x40,data10); send_data(0x30,data11); + send_data(0x18,data_servo); data10=0x3f; @@ -503,12 +505,12 @@ } else if(circle!=old_circle) { old_circle=circle; //バスタオル挟む機構 - if(circle==1) { + if(circle==1&&(get_data_rs232 & 0b00000011)) { if(k==1) { data_servo=0x03; //send_data(0x18,data_servo); k=0; - } else if(k==0) { + } else if(k==0&&(get_data_rs232 & 0b00000011)) { data_servo=0x04; //send_data(0x18,data_servo); k=1; @@ -658,7 +660,7 @@ data_servo=0x07; send_data(0x18,data_servo); - wait(1.3); + wait(1.2); data7=0x00; get_data_rs232=get_data_rs232 & 0b11101111; while(!(get_data_rs232 & 0x10)) { @@ -669,7 +671,7 @@ send_data(0x24,data7); data_servo=0x08; send_data(0x18,data_servo); - wait(1.3); + wait(1.2); data7=0xff; get_data_rs232=get_data_rs232 & 0b11011111; while(!(get_data_rs232 & 0x20)) { @@ -685,7 +687,7 @@ data_servo=0x07; send_data(0x18,data_servo); - wait(1.3); + wait(1.2); data7=0x00; send_data(0x24,data7); wait(0.3); @@ -693,7 +695,7 @@ send_data(0x24,data7); data_servo=0x08; send_data(0x18,data_servo); - wait(1.3); + wait(1.2); data7=0xff; get_data_rs232=get_data_rs232 & 0b11011111; while(!(get_data_rs232 & 0x20)) { @@ -724,7 +726,7 @@ data_servo=0x07; send_data(0x24,data_servo); timer2.start(); - if(timer2.read()>3.5){ + if(timer2.read()>3.5f){ timer2.stop(); timer2.reset(); p=2; @@ -745,7 +747,7 @@ data_servo=0x08; send_data(0x18,data_servo); timer2.start(); - if(timer2.read()>1.3){ + if(timer2.read()>1.3f){ p=4; } @@ -859,7 +861,7 @@ data_servo=0x07; send_data(0x18,data_servo); timer2.start(); - if(timer2.read()>1.5){ + if(timer2.read()>1.5f){ timer2.stop(); timer2.reset(); r=2; @@ -870,7 +872,7 @@ data7=0x00; send_data(0x24,data7); timer2.start(); - if(timer2.read()>0.3){ + if(timer2.read()>0.3f){ timer2.stop(); timer2.reset(); data7=0x10; @@ -882,6 +884,7 @@ case 3: data11=0xff; send_data(0x30,data11); + //get_data_rs232=get_data_rs232 & 0b10111111; if(get_data_rs232 & 0x40){ data11=0x10; send_data(0x30,data11); @@ -892,6 +895,7 @@ case 4: data11=0x00; send_data(0x30,data11); + //get_data_rs232=get_data_rs232 & 0b01111111; if(get_data_rs232 & 0x80){ data11=0x10; send_data(0x30,data11); @@ -902,6 +906,7 @@ case 5: data7=0xff; send_data(0x24,data7); + //get_data_rs232=get_data_rs232 & 0b11011111; if(get_data_rs232 & 0x20){ data7=0x10; send_data(0x24,data7); @@ -930,7 +935,7 @@ data8=0x00; data9=0x00; data10=0x00; - }else if(left2==0&&(old_triangle!=triangle)&&select==0){ + }else if(left2==0&&(old_triangle!=triangle)&&select==0&&(get_data_rs232 & 0b00000011)){ old_triangle=triangle; if(triangle==1){ data8=0xff;