6/8 操舵中央 ピッチ操作追加版

Dependencies:   mbed

Fork of Souda_Main_ver3 by albatross

Revision:
2:9dc7d5f1e910
Parent:
1:65a3a2a4f535
Child:
3:0e66ce2ab2fb
--- a/main.cpp	Tue Feb 16 08:09:38 2016 +0000
+++ b/main.cpp	Tue Feb 16 09:50:45 2016 +0000
@@ -1,7 +1,7 @@
 //中央can program
 
 #include "mbed.h"
-#define WAIT_LOOP_TIME 0.1
+#define WAIT_LOOP_TIME 1
 #define YOKUTAN_DATAS_NUM 5
 #define IMPUT_DATAS_NUM 2
 #define SEND_DATAS_CAN_ID 100
@@ -25,16 +25,16 @@
 char inputDatas_L[IMPUT_DATAS_NUM];
 
 CANMessage recmsg_R(SEND_DATAS_CAN_ID, inputDatas_R, IMPUT_DATAS_NUM);
-CANMessage recmsg_L(SEND_DATAS_CAN_ID, inputDatas_R, IMPUT_DATAS_NUM);
+CANMessage recmsg_L(SEND_DATAS_CAN_ID, inputDatas_L, IMPUT_DATAS_NUM);
 
 void InputAndSentControlValues_R(){
-    inputDatas_R[0] = eruron_R;
-    inputDatas_R[1] = drug_R;
-    for(int i = 0; i < IMPUT_DATAS_NUM; i++){
+    inputDatas_R[0] = 1 - inputDatas_R[0];
+    inputDatas_R[1] = 1 - inputDatas_R[1];
+    //for(int i = 0; i < IMPUT_DATAS_NUM; i++){
         if(can_R.write(recmsg_R)){
-            //pc.printf("Right successed!\n\r");
+            pc.printf("Right successed!\n\r");
         }
-    }
+    //}
 }
 
 void ledcheck_R() {
@@ -63,17 +63,17 @@
     else{
         eruron_R = 0;
         eruron_L = 0;
-        }
-        }
+    }
+}
 
 void InputAndSentControlValues_L(){
-    inputDatas_L[0] = eruron_L;
-    inputDatas_L[1] = drug_L;
-    for(int i = 0; i < IMPUT_DATAS_NUM; i++){
+    inputDatas_L[0] = 1 - inputDatas_L[0];
+    inputDatas_L[1] = 1 - inputDatas_L[1];
+    //for(int i = 0; i < IMPUT_DATAS_NUM; i++){
         if(can_L.write(recmsg_L)){
-           // pc.printf("Left successed!\n\r");
+            pc.printf("Left successed!\n\r");
         }
-    }
+    //}
 }
 
 void SendDarasToKeiki(){
@@ -88,6 +88,9 @@
         pc.printf("R : ");
         pc.printf("%i:",yokutanDatas_R[i]);
     }
+    for(int i = 0; i < IMPUT_DATAS_NUM; i++){
+        pc.printf("%d:%d",i,inputDatas_R[i]);
+    }
     pc.printf("\t");
 }
 
@@ -100,6 +103,10 @@
 }
 
 void init(){
+    for(int i = 0; i < IMPUT_DATAS_NUM; i++){
+        inputDatas_R[i] = 0;
+        inputDatas_L[i] = 0;
+    }
 }
 
 
@@ -122,7 +129,7 @@
 int main(){
     init();
     while(1){
-        servo_check();
+        //servo_check();
         InputAndSentControlValues_R();
         InputAndSentControlValues_L();
         wait_us(10);