![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
メインプログラム最新版です
Dependencies: mbed SBDBT arrc_mbed
Diff: main.cpp
- Revision:
- 7:59be95fceafa
- Parent:
- 6:fd9b59f828e8
- Child:
- 8:e76d6c16d7af
--- a/main.cpp Sat Jan 29 14:48:41 2022 +0000 +++ b/main.cpp Thu Feb 03 13:31:38 2022 +0000 @@ -25,10 +25,15 @@ const int y_component_cmd = 2; const int l2_cmd = 3; const int r2_cmd = 4; + const int l1_cmd = 5; //ビーンバッグ回収用 //ビーンバッグ発射用 + const int load = 3; + const int revolver = 4; + const int back = 5; + const int shot = 6; //農作物回収・設置用 const int up = 1; @@ -37,13 +42,14 @@ //テープLED用 //遠隔非常停止受信用 - const int //全体送信用 const int select = 50;//手動・自動切り替え const int stop_all = 51;//全プログラム停止 //変数 + bool auto_mode = false; + bool auto_start; int x_component; int y_component; int l2_num; @@ -56,25 +62,40 @@ y_component = sb.rsy(); l2_num = sb.l2An(); r2_num = sb.r2An(); + if(select() == 1){ + auto_mode =! auto_mode; + } //足回り scrp.send1(wheel_num,x_component_cmd,x_component); - wait_ms(1); + wait_ms(2); scrp.send1(wheel_num,y_component_cmd,y_component); - wait_ms(1); + wait_ms(2); scrp.send1(wheel_num,l2_cmd,l2_num); - wait_ms(1); + wait_ms(2); scrp.send1(wheel_num,r2_cmd,r2_num); - wait_ms(1); + wait_ms(2); + scrp.send1(wheel_num,l1_cmd,sb.l1()); + wait_ms(2); //ビーンバッグ回収 //ビーンバッグ発射 + if(auto_mode == true){ + scrp.send1(BeanbagShot_num,load,down()); + wait_ms(2); + scrp.send1(BeanbagShot_num,revolver,right()); + wait_ms(2); + scrp.send1(BeanbagShot_num,back,up()); + wait_ms(2); + scrp.send1(BeanbagShot_num,shot,left()); + wait_ms(2); + } //農作物回収・設置 //全体送信 - scrp.send1(send_all,select,sb.select());//自動・手動モード切り替え + scrp.send1(send_all,select,auto_mode);//自動・手動モード切り替え wait_ms(1); } } \ No newline at end of file