root / trunk / code / projects / linefollowing / lineFollow.h @ 1851
History | View | Annotate | Download (1.27 KB)
1 |
#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 |
int lineFollow(int speed); |
24 |
|
25 |
/* turnLeft and turnRight
|
26 |
Must be called inside a loop
|
27 |
returns 0 when complete
|
28 |
*/
|
29 |
int turnLeft();
|
30 |
int turnRight();
|
31 |
|
32 |
/* updateLine
|
33 |
Reads in the analog values
|
34 |
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 |
void updateBarCode();
|
48 |
|
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
|