-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.h
58 lines (40 loc) · 1.37 KB
/
config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* MOTOR */
const int MOTOR_LEFT_1_PIN = 21;
const int MOTOR_LEFT_2_PIN = 20;
const int MOTOR_RIGHT_1_PIN = 22;
const int MOTOR_RIGHT_2_PIN = 23;
int PWM_SPEED = 200;
int leftPWM = 0;
int rightPWM = 0;
/* Sensors */
const int SENSOR_FRONT_OUT_PIN = 17;
const int SENSOR_LEFT_OUT_PIN = 16;
const int SENSOR_RIGHT_OUT_PIN = 15;
const int STARTMODULE_PIN = 14;
const int LED_SLOW_BLINK = 750; //ms
const int LED_FAST_BLINK = 200; //ms
/* Led */
#define PIN 2
Adafruit_NeoPixel strip = Adafruit_NeoPixel(3, PIN, NEO_GRB + NEO_KHZ800);
bool changecolor = 1;
int lysteller = 0;
const int LED_PIN = 13; //Onboard LED
/* Variables */
int frontSensorValue = 0;
int rightSensorValue = 0;
int leftSensorValue = 0;
int pos = 0;
int right_limited_cm = 0;
int left_limited_cm = 0;
/* Constants */
const int SENSOR_AVERAGE_COUNT = 5; //Readings from sensors are smoothed out using an average of the last X readings.
const int SENSOR_MIN_DISTANCE = 10; //cm
const int SENSOR_MAX_DISTANCE = 150; //cm
const int SLOW_TO_FAST_DISTANCE = 70; //cm. If distance in front shorter than this, go SLOW. If equal or over, go FAST.
const int CRASH_DISTANCE = 30; //cm - below this indicates that we've stuck up against a wall or opponent.
enum startmoduleStates {
WAITING,
RUNNING,
STOP
};
volatile startmoduleStates startmodule_state = WAITING;