メインマイコンのプログラム

Dependencies:   mbed SBDBT_for_2022gourobo arrc_mbed

Revision:
6:fd9b59f828e8
Parent:
3:e4b5563563af
Child:
7:59be95fceafa
--- a/main.cpp	Fri Jan 21 09:09:48 2022 +0000
+++ b/main.cpp	Sat Jan 29 14:48:41 2022 +0000
@@ -6,33 +6,58 @@
 //---------------初期設定---------------
     //scrp_slave
     ScrpSlave scrp(PC_12,PD_2,PH_1,0x0807f800);
+    
     //sbdbt
-    sbdbt sb(A0,A1);     
+    sbdbt sb(A0,A1);
+        
     //scrp_slaveのid設定
-    const int wheel_num = 255;
+    const int wheel_num = 1;
     const int BeanbagGet_num = 2;
     const int BeanbagShot_num = 3;
     const int TakoGetPut_num = 4;
+    const int tape_LED_num = 5;
+    const int remort_stop_num = 6;
+    const int send_all = 255;
+    
     //コマンド番号設定
+    //足回り用
     const int x_component_cmd = 1;
     const int y_component_cmd = 2;
     const int l2_cmd = 3;
     const int r2_cmd = 4;
-    const int select = 5;
+    
+    //ビーンバッグ回収用
+    
+    //ビーンバッグ発射用
+    
+    //農作物回収・設置用
+    const int up = 1;
+    const int down = 2;
+    
+    //テープLED用
+    
+    //遠隔非常停止受信用
+    const int 
+    
+    //全体送信用
+    const int select = 50;//手動・自動切り替え
+    const int stop_all = 51;//全プログラム停止
+    
     //変数
     int x_component;
     int y_component;
     int l2_num;
     int r2_num;
 //-------------------------------------
-//スティックの返り値-128~127
+
     while(true){
         sb.button_state();
-        x_component = sb.lsx();
-        y_component = sb.lsy();
+        x_component = sb.rsx();
+        y_component = sb.rsy();
         l2_num = sb.l2An();
         r2_num = sb.r2An();
-        //printf("%d %d",x_component,y_component);
+        
+        //足回り
         scrp.send1(wheel_num,x_component_cmd,x_component);
         wait_ms(1);
         scrp.send1(wheel_num,y_component_cmd,y_component);
@@ -41,7 +66,15 @@
         wait_ms(1);
         scrp.send1(wheel_num,r2_cmd,r2_num);
         wait_ms(1);
-        scrp.send1(wheel_num,select,sb.select());
+        
+        //ビーンバッグ回収
+        
+        //ビーンバッグ発射
+        
+        //農作物回収・設置
+        
+        //全体送信
+        scrp.send1(send_all,select,sb.select());//自動・手動モード切り替え
         wait_ms(1);
     }
 }
\ No newline at end of file