3/18 翼端操舵

Dependencies:   ADXL345_I2C Control_Yokutan_CANver1 mbed

Fork of ControlYokutan02 by albatross

Revision:
7:d6a3e47e6ef9
Parent:
5:7459a428e16e
Child:
8:a28e4a469b8d
--- a/main.cpp	Wed Feb 17 02:29:14 2016 +0000
+++ b/main.cpp	Wed Feb 17 02:48:01 2016 +0000
@@ -19,7 +19,7 @@
 DigitalOut led1(LED1);
 AnalogIn a(p20);
 AnalogIn b(p19);
-DigialIn switch1(p15);
+DigitalIn switch1(p15);
 
 char toSendDatas[TO_SEND_DATAS_NUM];
 char controlValues[CONTROL_VALUES_NUM];//0:eruruon,1:drug
@@ -127,8 +127,8 @@
 
 void WriteServo(int a,int b){
     if(a >= 45 && a <= 90 && b >= 45 && b <= 90){
-    if(controlValues[0] == (char)1){
-      servo1.Pulsewidth(calcPulse(90));
+    if(controlValues[0] == (char)1)
+      servo1.pulsewidth(calcPulse(90));
     else{
         servo1.pulsewidth(calcPulse(a));
     }
@@ -138,20 +138,20 @@
     else{
         servo2.pulsewidth(calcPulse(b));
     }
-    }
+    
     //servo1.pulsewidth(calcPulse(a.read()*170));
 //    servo2.pulsewidth(calcPulse(b.read()*170));
     //pc.printf("%f", a.read());
 }
-
+}
 
 //初期迎角を変える
 void Debug(){
     if(switch1 ==  1){
     neutral_a = (int)(a * 180);
     neutral_b = (int)(b * 180);
-    WriteServo(neutral_a);
-    WriteServo(neutral_b);
+    WriteServo(neutral_a,neutral_b);
+
     }
     }