Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Control_Yokutan_CANver1 XBusServo mbed mbed-rtos
Fork of ControlYokutan2017_2 by
Diff: main.cpp
- Revision:
- 13:5e3b4120dbbf
- Parent:
- 12:fd9d241843f4
- Child:
- 14:1f6dd929d7de
--- a/main.cpp Fri Feb 26 09:00:53 2016 +0000
+++ b/main.cpp Sat Feb 27 04:33:21 2016 +0000
@@ -11,15 +11,15 @@
#define ADXL_MEAN_NUM 10
#define SEND_DATAS_LOOP_TIME 0.1
-#define ERURON_MOVE_DEG_INI_R 10
-#define DRUG_MOVE_DEG_INI_R -92
-#define ERURON_TRIM_INI_R 96
-#define DRUG_TRIM_INI_R 109
+#define ERURON_MOVE_DEG_INI_R 1
+#define DRUG_MOVE_DEG_INI_R 1
+#define ERURON_TRIM_INI_R 1
+#define DRUG_TRIM_INI_R 1
-#define ERURON_MOVE_DEG_INI_L 10
-#define DRUG_MOVE_DEG_INI_L -92
-#define ERURON_TRIM_INI_L 96
-#define DRUG_TRIM_INI_L 109
+#define ERURON_MOVE_DEG_INI_L 2
+#define DRUG_MOVE_DEG_INI_L 2
+#define ERURON_TRIM_INI_L 2
+#define DRUG_TRIM_INI_L 2
CAN can(p30,p29);
CANMessage recmsg;
@@ -27,8 +27,8 @@
ADXL345_I2C accelerometer(p9, p10);
I2C ina226_i2c(p28,p27);
INA226 VCmonitor(ina226_i2c);
-PwmOut drugServo(p23);
-PwmOut eruronServo(p22);
+PwmOut drugServo(p22);
+PwmOut eruronServo(p23);
DigitalOut led1(LED1);
AnalogIn drugAna(p20);
AnalogIn eruronAna(p19);
@@ -41,7 +41,7 @@
DigitalOut led4(LED4);
Ticker sendDatasTicker;
Ticker toStringTicker;
-
+//
char toSendDatas[TO_SEND_DATAS_NUM];
char controlValues[CONTROL_VALUES_NUM];//0:eruruon,1:drug
@@ -96,16 +96,16 @@
void init(){
if(LRstatePin){
+ eruronTrim = ERURON_TRIM_INI_L;
+ drugTrim = DRUG_TRIM_INI_L;
+ eruronMoveDeg = ERURON_MOVE_DEG_INI_L;
+ drugMoveDeg = DRUG_MOVE_DEG_INI_L;
+ }
+ else{
eruronTrim = ERURON_TRIM_INI_R;
drugTrim = DRUG_TRIM_INI_R;
eruronMoveDeg = ERURON_MOVE_DEG_INI_R;
- drugMoveDeg = DRUG_MOVE_DEG_INI_R;
- }
- else{
- eruronTrim = ERURON_TRIM_INI_L;
- drugTrim = DRUG_TRIM_INI_L;
- eruronMoveDeg = ERURON_MOVE_DEG_INI_L;
- drugMoveDeg =DRUG_MOVE_DEG_INI_L;
+ drugMoveDeg =DRUG_MOVE_DEG_INI_R;
}
SERVO_FLAG = servoInit();
ADXL_FLAG = adxlInit();
@@ -203,6 +203,7 @@
while(checkMaxDegPin){
checkMaxDeg();
}
+ pc.printf("eT:%f\n\r",eruronTrim);
led4 = 0;
debugLED = 0;
receiveDatas();
