Project

General

Profile

Revision 1880

testing file for validTurns.c. Also documents how "barcode" (eventually
will be the value from the table look up) is implemented/used.

View differences:

trunk/code/projects/traffic_navigation/validTurns-test.c
1
#include <dragonfly_lib.h>
2
#include "lineDrive.h"
3
#include "validTurns.h"
4

  
5
int main(){
6
/*barcode should be written as double type (DOUBLE_C or DOUBLE_T), crosstype, crosspos, turntype. 6-9 bit integers*/
7

  
8
dragonfly_init(ALL_ON);
9
orb1_set_color(YELLOW);
10

  
11
int barcode1 = (DOUBLE_C<<4)+(DOUBLE<<2)+(TMIDDLE);
12
if (validateTurn(barcode1, ILEFT)==ILEFT) orb1_set_color(GREEN);
13

  
14
delay_ms(100);
15
orb1_set_color(PINK);
16
delay_ms(50);
17

  
18
int barcode2 = (DOUBLE_C<<4)+(DOUBLE<<2)+(TMIDDLE);
19
if (validateTurn(barcode2, IUTURN)==IUTURN) orb1_set_color(GREEN);
20

  
21
delay_ms(100);
22
orb1_set_color(RED);
23
delay_ms(50);
24

  
25
int barcode3 = (DOUBLE_T<<4)+(DOUBLE<<2)+(TMIDDLE);
26
if (validateTurn(barcode3, IUTURN)==IUTURN) orb1_set_color(GREEN);
27

  
28
delay_ms(100);
29
orb1_set_color(PURPLE);
30
delay_ms(50);
31

  
32
int barcode4 = (DOUBLE_T<<4)+(DOUBLE<<2)+(TMIDDLE);
33
if (validateTurn(barcode4, ISTRAIGHT)==IUTURN) orb1_set_color(GREEN);
34

  
35
while (1){}
36

  
37
}
38

  
0 39

  

Also available in: Unified diff