Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / linefollowing / lineFollow.h @ 1851

History | View | Annotate | Download (1.27 KB)

1 1841 djacobs
#include <dragonfly_lib.h>
2
3
 #ifndef _LINEFOLLOW_H_
4
 #define _LINEFOLLOW_H_
5
6
#define WHITE                        0
7
#define GREY                        1
8
#define BLACK                         2
9
#define CENTER                        3
10
#define NOLINE                        -42
11
#define LINELOST                -1
12
13
/*         lineFollow_init
14
        Must call before lineFollow
15
        Turns analog loop off
16
*/
17
void lineFollow_init();
18
19
/*        lineFollow
20
        Must call lineFollow first
21
        Must be called inside a loop
22
*/
23 1851 djacobs
int lineFollow(int speed);
24 1841 djacobs
25 1851 djacobs
/*        turnLeft and turnRight
26
        Must be called inside a loop
27
        returns 0 when complete
28 1841 djacobs
*/
29 1851 djacobs
int turnLeft();
30
int turnRight();
31 1841 djacobs
32
/*        updateLine
33 1851 djacobs
        Reads in the analog values
34 1841 djacobs
        Fills the given array with WHITE
35
        or BLACK representing the line
36
*/
37
void updateLine(int* values);
38
39
/*        lineLocate
40
        Finds the location of the line
41
        Outputs positive for right side
42
        Negative for left, or NOLINE if a line is not found
43
*/
44
int lineLocate(int* colors);
45
46
//Not implemented yet, returns ???
47 1842 djacobs
void updateBarCode();
48 1841 djacobs
49
/*        min
50
        returns the minimum of two values
51
*/
52
int min(int x, int y);
53
54
/*        motorLeft
55
        Commands the left motor
56
        Cannot be used to stop
57
        0-126 are backward
58
        127-255 are forward
59
*/
60
void motorLeft(int speed);
61
62
/*        motorRight
63
        Commands the right motor
64
        Cannot be used to stop
65
        0-126 are backward
66
        127-255 are forward
67
*/
68
void motorRight(int speed);
69
70
/*        lost
71
        Internal counter to detect if the line was lost
72
*/
73
int lost;
74
75
#endif