2
Dependencies: AQM0802A HMC6352 PID Servo mbed
Diff: main.h
- Revision:
- 3:0c994b3a882e
- Parent:
- 0:dfe81bdcb486
- Child:
- 4:f7946508daa8
--- a/main.h Fri Feb 13 10:11:49 2015 +0000 +++ b/main.h Mon Mar 02 05:55:33 2015 +0000 @@ -1,3 +1,58 @@ + +/*PID処理*/ +#define RATE 0.18//52 +#define PID_BIAS 0.3 +#define REFERENCE 180.0 +#define MINIMUM 0.1 +#define MAXIMUM 360.0 +#define P_GAIN 1.8//1.4 //0.78 +#define I_GAIN 0.0 //0.0 +#define D_GAIN 0.05 //0.009 +#define OUT_LIMIT 50.0 +#define MAX_POW 100 +#define MIN_POW -100 + +/*回り込みの計算用*/ +#define PI 3.1415926 + +/*LPC1114 I2C Slave Address*/ +#define ADDRESS_R 0xAA +#define ADDRESS_L 0xAC + +/*BusIn sw 入力値*/ +#define StartS 0x01 +#define Debug1 0x02 +#define Debug2 0x04 +#define Debug3 0x06 +#define Kicker 0x08 +#define Calibration 0x10 + + +#define CW 1 +#define CCW -1 + +BusIn Sw(p22,p23,p24,p25,p26); +BusIn Line(p5,p6,p7,p8);//No reading line → 0b1111 ,not pull up +DigitalOut Led[4] = {LED1,LED2,LED3,LED4}; +DigitalOut Kick(p29); + +Servo S555(p21); +I2C Sensor(p9,p10);//sda,scl +HMC6352 hmc6352(p9,p10);//sda,scl +AQM0802A Lcd(p28,p27);//sda,scl +Serial Motor(p13,p14);//tx,rx +Serial pc(USBTX,USBRX); + +/*Compass PID SetUp*/ +PID pid(P_GAIN,I_GAIN,D_GAIN, RATE); + +extern string StringFIN; +extern void array(int,int,int,int); + +int speed[4] = {0}; +typedef enum {FRONT = 1, RIGHT, BACK, LEFT, NA} Direction; +enum {SONIC = 0x01, BALL}; + int TargetCoordinates[12][2][2] = { {{0,1},{0,1}},//p,q+6