root / trunk / code / projects / traffic_navigation / validTurns-test.c @ 1884
History | View | Annotate | Download (934 Bytes)
1 | 1880 | pdeo | #include <dragonfly_lib.h> |
---|---|---|---|
2 | #include "lineDrive.h" |
||
3 | #include "validTurns.h" |
||
4 | |||
5 | 1883 | jdcooper | #ifdef TEST_VALIDTURNS
|
6 | |||
7 | 1880 | pdeo | int main(){
|
8 | 1881 | pdeo | /*barcode should be written as crosstype, crosspos. 5 bit integers*/
|
9 | 1880 | pdeo | |
10 | 1884 | jdcooper | /*barcode should be three bits of intersection type and 2 of entrypoint*/
|
11 | |||
12 | 1880 | pdeo | dragonfly_init(ALL_ON); |
13 | orb1_set_color(YELLOW); |
||
14 | |||
15 | 1881 | pdeo | int barcode1 = (DOUBLE_C<<2)+(TMIDDLE); |
16 | 1880 | pdeo | if (validateTurn(barcode1, ILEFT)==ILEFT) orb1_set_color(GREEN);
|
17 | |||
18 | delay_ms(100);
|
||
19 | orb1_set_color(PINK); |
||
20 | delay_ms(50);
|
||
21 | |||
22 | 1881 | pdeo | int barcode2 = (DOUBLE_C<<2)+(TMIDDLE); |
23 | 1880 | pdeo | if (validateTurn(barcode2, IUTURN)==IUTURN) orb1_set_color(GREEN);
|
24 | |||
25 | delay_ms(100);
|
||
26 | orb1_set_color(RED); |
||
27 | delay_ms(50);
|
||
28 | |||
29 | 1881 | pdeo | int barcode3 = (DOUBLE_T<<2)+(TMIDDLE); |
30 | 1880 | pdeo | if (validateTurn(barcode3, IUTURN)==IUTURN) orb1_set_color(GREEN);
|
31 | 1882 | pdeo | |
32 | 1880 | pdeo | delay_ms(100);
|
33 | orb1_set_color(PURPLE); |
||
34 | delay_ms(50);
|
||
35 | |||
36 | 1881 | pdeo | int barcode4 = (DOUBLE_T<<2)+(TMIDDLE); |
37 | 1880 | pdeo | if (validateTurn(barcode4, ISTRAIGHT)==IUTURN) orb1_set_color(GREEN);
|
38 | |||
39 | while (1){} |
||
40 | |||
41 | } |
||
42 | |||
43 | 1883 | jdcooper | #endif TEST_VALIDTURNS |