Ryo Ogata
/
jumpROBO6_2_1
kairyou sita
Fork of jumpROBO6_2 by
Diff: main.h
- Revision:
- 0:4c7c138f3891
- Child:
- 1:b81c22891370
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.h Sat Oct 19 04:50:26 2013 +0000 @@ -0,0 +1,64 @@ +///////////////////////////////////////OGATA////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////// +//センサの数 +#define COLOR_NUM 6 + +//閾値 +#define R_THR 65 +#define G_THR 65 +#define B_THR 65 +#define PINR_THR 2000 + + +enum{ + GO, + STOP +}; + +//TextLCD lcd(p30, p29, p28, p27, p26, p25, TextLCD::LCD20x4); // rs, e, d4-d7 +ColorSensor color0(p20, p17, p18, p19, 10); +ColorSensor color1(p16, p13, p14, p15, 10); +ColorSensor color2(p12, p9, p10, p11, 10); +ColorSensor color3(p8, p5, p6, p7, 10); + +ColorSensor color4(p24, p21, p22, p23, 10); +ColorSensor color5(p30, p25, p26, p29, 10); +//ColorSensor color4(p26, p23, p24, p25, 10); +//ColorSensor color5(p30, p27, p28, p29, 10); + +Serial pc(USBTX, USBRX); // tx, rx +DigitalOut led[4] = {LED1,LED2,LED3,LED4}; +//DigitalOut air[2] = {p7,p8}; + + +//Servo myservo1(p21); +//DigitalIn sw1(p22); + + + +Timer color_t[COLOR_NUM]; +Timer jump_t; +Ticker interrupt0; + + +void rivisedate (); +void colorUpdate (uint8_t mode); +uint16_t moving_ave(uint8_t num, uint16_t data); +uint8_t robotFront(); +uint8_t jumpInstruction(uint8_t front); +uint8_t robotoStop(); + + +double proportional = 0; +uint16_t com_val = 0; +unsigned redp[COLOR_NUM], greenp[COLOR_NUM], bluep[COLOR_NUM]; +double rir,rib ; + + + +enum{ + WAIT, + STRAIGHT, + TURN, + COMP +}; \ No newline at end of file