-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main_USB.ino.txt
129 lines (84 loc) · 1.55 KB
/
Main_USB.ino.txt
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// You are on the USB. :3
/* ---------------------- DO NOT TOUCH ---------------------- */
#include "Functions.h"
#define S forwardStart
#define E forwardEnd
#define F forwardOneSquare
#define B backwardOneSquare
#define L turnLeft
#define R turnRight
/* ----------------------------------------------------------- */
/* ----------------------- EDIT THESE ------------------------ */
#define PRINT_TIME // Comment after you're done (if you want).
void sequence() {
S(); // Start
L();
F();
R();
F();
L();
F();
F();
L();
F();
L();
F(); // at gate A
B();
L();
F();
R();
F();
F();
R();
F();
L();
F(); // at start square
L();
F(); // other gates
F();
F();
L();
F();
L();
F();
R();
F();
R();
F(); // at endpoint
L();
F();
L();
F();
B();
L();
E(); // End
}
void setup() {
#ifndef NO_WAIT
/* ADJUST THESE VALUES ACCORDINGLY */
w.targetTime = 60000;
w.numOfOneSquare = 20 + 2; // # of F() + B()
w.numOfTurn = 5 + 12; // # of R() + L()
w.turnTime = 2500; // 2300 <= turnTime <= 4500 (maybe a bit more if ur feeling risky)
/* ----------------------------------------------------------- */
/* ---------------------- DO NOT TOUCH ----------------------- */
w.calculate();
#endif
#ifdef PRINT_TIME
Serial.begin(9600);
w.print();
Serial.end();
#endif
my_init();
while (!isRunning);
changeMode();
delay(1000);
mpu.calcGyroOffsets();
delay(300);
angle = round(mpu.getAngleZ());
sequence();
brake();
delay(5000);
}
void loop() {
}