-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRPG Complete
68 lines (64 loc) · 1.24 KB
/
RPG Complete
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
#include <kipr/wombat.h>
//motor right zero, motor left 2
int main()
{
wait_for_light(0);
mav(0,0);
msleep(20000);
int turn = 1300;
int straight = 1000;
// waiting to cross black tape
while (analog(1) < 1600)
{
mav(0,800);
mav(2,800);
msleep(100);
}
// crossing black tape to other side
mav(0,800);
mav(2,800);
msleep(900);
ao();
// 90 degree turn clockwise
mav(0,-1500);
mav(2,1500);
msleep(850);
// move forward
mav(0,1175);
mav(2,1000);
msleep(1800);
cmpc(0);
//start line follow
while(gmpc(0)< 20000) // The 17000 respents ticks in the wheel or the distance the wheel has turned.
{
if (analog(1)<1600)
{
mav(0,straight);
mav(2, turn);
msleep(100);
}
else
{
mav(0,turn);
mav(2,straight);
msleep(100);
}
}
mav(0,-1500);
mav(2,-1500);
msleep(500);
mav(0,750);
mav(2,750);
msleep(1000);
mav(0,1500);
mav(2,1500);
msleep(700);
mav(0,-1500);
mav(2,-1500);
msleep(1000);
mav(0,1500);
mav(2,1500);
msleep(2000);
ao;
return 0;
}