2/13 操舵翼端CAN

Dependencies:   ADXL345_I2C Control_Yokutan_CANver1 mbed

Fork of Control_Yokutan_CAN_ver1 by albatross

Revision:
10:439e73c9a207
Parent:
9:450cafd95ac3
Child:
11:44fea1d768b5
--- a/main.cpp	Wed Feb 24 10:21:46 2016 +0000
+++ b/main.cpp	Thu Feb 25 09:12:31 2016 +0000
@@ -10,8 +10,10 @@
 #define TO_SEND_CAN_ID 100
 #define ADXL_MEAN_NUM 10
 #define SEND_DATAS_LOOP_TIME 0.1
-#define ERURON_MOVE_DEG_INI 0
-#define DRUG_MOVE_DEG_INI 0
+#define ERURON_MOVE_DEG_INI 10
+#define DRUG_MOVE_DEG_INI -92
+#define ERURON_TRIM_INI 96
+#define DRUG_TRIM_INI 109
 #define start 510
 #define end 2390
 
@@ -38,8 +40,8 @@
 char toSendDatas[TO_SEND_DATAS_NUM];
 char controlValues[CONTROL_VALUES_NUM];//0:eruruon,1:drug
 
-float eruronTrim;
-float drugTrim;
+float eruronTrim = ERURON_TRIM_INI;
+float drugTrim = DRUG_TRIM_INI;
 float eruronMoveDeg = ERURON_MOVE_DEG_INI;
 float drugMoveDeg = DRUG_MOVE_DEG_INI;
 unsigned short ina_val;
@@ -137,6 +139,7 @@
         float b = drugAna.read()*180;
         eruronServo.pulsewidth(calcPulse(eruronAna.read()*180));
         drugServo.pulsewidth(calcPulse(drugAna.read()*180));
+        pc.printf("eruron:%f    drug:%f\n\r",a,b);
     }
     else{
         led3 = 0;
@@ -162,6 +165,7 @@
     drugServo.pulsewidth(calcPulse(drugTemp));
     eruronMoveDeg = eruronTemp-eruronTrim;
     drugMoveDeg = drugTemp-drugTrim;
+    pc.printf("eMD:%f   dMD:%f\n\r",eruronMoveDeg,drugMoveDeg);
     wait_us(10);
 }