3/18 翼端操舵
Dependencies: ADXL345_I2C Control_Yokutan_CANver1 mbed
Fork of ControlYokutan02 by
Revision 16:82310bf7c326, committed 2016-03-18
- Comitter:
- taurin
- Date:
- Fri Mar 18 06:13:47 2016 +0000
- Parent:
- 15:1db5ee4fe7ce
- Commit message:
- 3/18 ????;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 1db5ee4fe7ce -r 82310bf7c326 main.cpp --- a/main.cpp Mon Mar 07 13:43:18 2016 +0000 +++ b/main.cpp Fri Mar 18 06:13:47 2016 +0000 @@ -10,6 +10,7 @@ #define TO_SEND_CAN_ID 100 #define ADXL_MEAN_NUM 10 #define SEND_DATAS_LOOP_TIME 0.1 +#define RECEIVE_DATAS_LOOP_TIME 0.05 #define ERURON_MOVE_DEG_INI_R -12 #define DRUG_MOVE_DEG_INI_R 96 @@ -41,7 +42,8 @@ DigitalOut led4(LED4); Ticker sendDatasTicker; Ticker toStringTicker; -// +Ticker receiveDatasTicker; + char toSendDatas[TO_SEND_DATAS_NUM]; char controlValues[CONTROL_VALUES_NUM];//0:eruruon,1:drug @@ -60,6 +62,8 @@ int adxl_mean_counter = 0; void toString(); +void receiveDatas(); +void WriteServo(); bool servoInit(){ drugServo.period_ms(INIT_SERVO_PERIOD_MS); @@ -111,7 +115,8 @@ ADXL_FLAG = adxlInit(); INA_FLAG = inaInit(); sendDatasTicker.attach(&sendDatas,SEND_DATAS_LOOP_TIME); - // toStringTicker.attach(&toString,0.5); + // toStringTicker.attach(&toString,0.5); + receiveDatasTicker.attach(&receiveDatas,RECEIVE_DATAS_LOOP_TIME); } void updateDatas(){ @@ -134,6 +139,7 @@ controlValues[i] = recmsg.data[i]; } led1 = !led1; + //WriteServo(); } } @@ -213,7 +219,7 @@ led4 = 0; debugLED = 0; - receiveDatas(); + //receiveDatas(); WriteServo(); updateDatas(); wait(WAIT_LOOP_TIME);