Revision 1902
Edited the .h and .c file so that global variables can be seen by other files with the .h file is included.
trunk/code/projects/traffic_navigation/highways.c | ||
---|---|---|
2 | 2 |
#include "lineDrive.h" |
3 | 3 |
#include <dragonfly_lib.h> |
4 | 4 |
|
5 |
static int counti =0;
|
|
6 |
static long averagei = 0;
|
|
7 |
static int states = 0;
|
|
5 |
int counti =0; |
|
6 |
long averagei = 0; |
|
7 |
int states = 0; |
|
8 | 8 |
int canMerge = 1; |
9 | 9 |
|
10 | 10 |
void highwayStart(){ |
11 | 11 |
canMerge = 1; |
12 | 12 |
} |
13 |
int changeLanes(){ |
|
13 |
static int changeLanes(){
|
|
14 | 14 |
if(counti<10000){ |
15 | 15 |
counti++; |
16 | 16 |
motor_r_set(FORWARD,232); |
trunk/code/projects/traffic_navigation/highways.h | ||
---|---|---|
1 | 1 |
#ifndef HIGHWAYS_H |
2 | 2 |
#define HIGHWAYS_H |
3 | 3 |
|
4 |
int highwayFSM(void); |
|
5 |
void highwayStart(void); |
|
4 |
int highwayFSM(void); //FSM for dogs
|
|
5 |
void highwayStart(void);//enables the option to merge, can only merge once
|
|
6 | 6 |
|
7 |
/*lets you change these variables in other files*/ |
|
8 |
|
|
9 |
extern int counti; |
|
10 |
extern int canMerge; |
|
11 |
extern long averagei; |
|
12 |
extern int states; |
|
13 |
|
|
7 | 14 |
#define COUNT_MAX 12 |
8 |
#define PASS_DISTANCE 275
|
|
15 |
#define PASS_DISTANCE 200
|
|
9 | 16 |
#endif |
Also available in: Unified diff