version 3 通信方式,マイコン等に変更あり
Dependencies: AQM0802A PID Servo mbed
Diff: main.h
- Revision:
- 5:09afcbe0c18f
- Parent:
- 4:2857f273a7f4
- Child:
- 6:bfc0e8d2d3ae
diff -r 2857f273a7f4 -r 09afcbe0c18f main.h --- a/main.h Wed Mar 11 01:03:00 2015 +0000 +++ b/main.h Fri Mar 13 01:14:38 2015 +0000 @@ -13,6 +13,9 @@ #define MIN_POW -100 #define PID_CYCLE 0.05 //s +/*Servoなんか*/ +#define WAIT_TIME 0.20 + /*Serial Mbed間*/ #define ADDRESS 0xAA @@ -22,6 +25,8 @@ #define Debug1 0x02 #define Debug2 0x04 #define Debug3 0x08 +#define Debug12 0x06 +#define Debug23 0x0C #define Kicker 0x10 #define CW 1 @@ -46,6 +51,9 @@ Ticker pidupdate; +/*Servo timer */ +Timeout STimer; + extern string StringFIN; extern void array(int,int,int,int); extern void micon_rx(void); @@ -59,9 +67,11 @@ /*Mbed sensor data */ uint8_t IrData[3] = {0},IrNum = 0; uint8_t PingData[4]={0}; -unsigned int Compass = 0; +int Compass = 0; +unsigned int CompassDef = 0; double SetC = 0, InputPID = 180.0, CompassPID = 0.0; +bool WaitFlag = 0; /* motor driver*/ @@ -119,29 +129,29 @@ volatile int DegreeToVector[5] = {1,-1,-1,1,1}; int wrapDegree[24] = { 0,// - 15,//15 + 30,//15 60,//30 - 80,//45 - 100,//60 - 110,//75 - 180,//90 - 180,//105 - 185,//120 - 230,//135 - 250,//150 - 260,//165 + 90,//45 + 130,//60 + 140,//75 + 170,//90 + 170,//105 + 170,//120 + 180,//135 + 200,//150 + 220,//165 90, //180 or270 - 100,//195 - 110,//210 - 130,//225 + 130,//195 + 150,//210 + 180,//225 175,//240 - 180,//255 - 180,//270 - 250,//285 - 260,//300 - 280,//315 - 300,//330 - 345//345 + 195,//255 + 195,//270 + 240,//285 + 230,//300 + 270,//315 + 290,//330 + 320//345 };