Revision 1858
Updated line following code from line following project
lineFollow.h | ||
---|---|---|
3 | 3 |
#ifndef _LINEFOLLOW_H_ |
4 | 4 |
#define _LINEFOLLOW_H_ |
5 | 5 |
|
6 |
#define LWHITE 0 |
|
7 |
#define LGREY 1 |
|
8 |
#define LBLACK 2 |
|
6 | 9 |
#define CENTER 3 |
7 | 10 |
#define NOLINE -42 |
8 |
#define SPEED 170 |
|
9 | 11 |
#define LINELOST -1 |
10 | 12 |
|
13 |
#define NOBARCODE -2 |
|
14 |
#define INTERSECTION -25 |
|
15 |
#define FULL_LINE -26 |
|
16 |
|
|
17 |
|
|
18 |
|
|
11 | 19 |
/* lineFollow_init |
12 | 20 |
Must call before lineFollow |
13 | 21 |
Turns analog loop off |
14 | 22 |
*/ |
15 |
void lineFollow_init(); |
|
23 |
void lineFollow_init(void);
|
|
16 | 24 |
|
17 | 25 |
/* lineFollow |
18 | 26 |
Must call lineFollow first |
19 | 27 |
Must be called inside a loop |
20 | 28 |
*/ |
21 |
int lineFollow(); |
|
29 |
int lineFollow(int speed);
|
|
22 | 30 |
|
23 |
/* assignColor |
|
24 |
Converts an analog color to WHITE or BLACK |
|
31 |
/* turnLeft turnRight mergeLeft mergeRight |
|
32 |
Must be called inside a loop |
|
33 |
returns 0 when complete |
|
25 | 34 |
*/ |
26 |
int assignColor(int port, int analog); |
|
35 |
int turnLeft(void); |
|
36 |
int turnRight(void); |
|
37 |
int mergeLeft(void); |
|
38 |
int mergeRight(void); |
|
27 | 39 |
|
28 |
/* updateIR |
|
29 |
Gets the value of the nth line sensor |
|
30 |
*/ |
|
31 |
int updateIR(int n); |
|
32 |
|
|
33 | 40 |
/* updateLine |
41 |
Reads in the analog values |
|
34 | 42 |
Fills the given array with WHITE |
35 | 43 |
or BLACK representing the line |
36 | 44 |
*/ |
... | ... | |
43 | 51 |
*/ |
44 | 52 |
int lineLocate(int* colors); |
45 | 53 |
|
46 |
//Not implemented yet, returns ??? |
|
47 |
void updateBarCode(); |
|
54 |
/* updatebarCode |
|
55 |
Reads in and processes |
|
56 |
bar code data |
|
57 |
*/ |
|
58 |
void updateBarCode(void); |
|
48 | 59 |
|
49 |
/* min |
|
50 |
returns the minimum of two values |
|
60 |
/* getBarCode |
|
61 |
returns a bar code, if |
|
62 |
available, otherwise NOBARCODE |
|
51 | 63 |
*/ |
64 |
int getBarCode(void); |
|
65 |
|
|
66 |
/* min max |
|
67 |
returns the minimum/maximum of two values |
|
68 |
*/ |
|
52 | 69 |
int min(int x, int y); |
70 |
int max(int x, int y); |
|
53 | 71 |
|
54 | 72 |
/* motorLeft |
55 | 73 |
Commands the left motor |
Also available in: Unified diff