Statistics
| Revision:

root / trunk / code / projects / linefollowing / main.c @ 1940

History | View | Annotate | Download (743 Bytes)

1
#include <dragonfly_lib.h>
2
#include <lineFollow.h>
3

    
4
/* 
5
*  read_line 0 = Sensor 1
6
*  read_line 1 = Sensor 8
7
*  read_line 2 = Sensor 4
8
*  read_line 3 = Sensor 6
9
*  read_line 4 = Sensor 2
10
*  read_line 5 = Sensor 7
11
*  read_line 6 = Sensor 3
12
*  read_line 7 = Sensor 5
13
*/
14

    
15
int main(void)
16
{
17

    
18
        /* initialize components, set wireless channel */
19
        dragonfly_init(ALL_ON);
20
        lineFollow_init();
21
        int barCode;
22
        while(1)
23
        {
24
                
25
                lineFollow(200);
26

    
27

    
28

    
29
        
30
        }
31
        return 0;
32
}
33
void right()
34
{
35
motor_r_set(BACKWARD, 200);
36
motor_l_set(FORWARD, 200);
37
delay_ms(400);
38
}
39

    
40
void straight()
41
{
42
motor_r_set(FORWARD, 210);
43
motor_l_set(FORWARD, 210);
44
delay_ms(200);
45
move(0,0);
46
delay_ms(2000);
47
}
48

    
49
void left()
50
{
51
motor_l_set(BACKWARD, 200);
52
motor_r_set(FORWARD, 200);
53
delay_ms(400);
54
}