-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDynamicInput.c
More file actions
98 lines (89 loc) · 2.81 KB
/
Copy pathDynamicInput.c
File metadata and controls
98 lines (89 loc) · 2.81 KB
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
#pragma config(Sensor, in1, POT, sensorPotentiometer)
#pragma config(Sensor, dgtl1, LD, sensorQuadEncoder)
#pragma config(Sensor, dgtl3, RD, sensorQuadEncoder)
#pragma config(Sensor, dgtl5, Rbutt, sensorTouch)
#pragma config(Sensor, dgtl6, DRII, sensorTouch)
#pragma config(Sensor, dgtl7, DRIDD, sensorTouch)
#pragma config(Sensor, dgtl8, LITT, sensorTouch)
#pragma config(Sensor, dgtl9, INKK, sensorTouch)
#pragma config(Sensor, dgtl10, INKTT, sensorTouch)
#pragma config(Motor, port2, LFD, tmotorVex393, openLoop)
#pragma config(Motor, port3, LBD, tmotorVex393, openLoop)
#pragma config(Motor, port4, RFD, tmotorVex393, openLoop, reversed)
#pragma config(Motor, port5, RBD, tmotorVex393, openLoop, reversed)
#pragma config(Motor, port6, LL, tmotorVex393, openLoop)
#pragma config(Motor, port7, RL, tmotorVex393, openLoop, reversed)
#pragma config(Motor, port8, ITL, tmotorVex269, openLoop)
#pragma config(Motor, port9, ITR, tmotorVex269, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
SensorValue[dgtl1] = SensorValue[dgtl3] = 0;
while(true){
bool dri = false;
int drid = 1000;
int lit = 0;
int ink = 0;
int inkt = 3000;
while(SensorValue[Rbutt] == 0){
if(SensorValue[DRII] == 1){
dri = true;
}
if(SensorValue[DRIDD] == 1){
drid = drid + 200;
}
if(SensorValue[LITT] == 1){
lit = lit + 1;
if(lit == 3){
lit = 0;
}
}
if(SensorValue[INKK] == 1){
ink = ink + 1;
if(ink == 3){
ink = 0;
}
}
if(SensorValue[INKTT] == 1){
inkt = inkt + 1000;
}
}
//
SensorValue[dgtl1] = SensorValue[dgtl3] = 0;
if(dri == true){
while(SensorValue[dgtl1] < drid && SensorValue[dgtl3] < drid){
motor[port2] = motor[port3] = motor[port4] = motor[port5] = 127;
}
motor[port2] = motor[port3] = motor[port4] = motor[port5] = 0;
}
if(lit == 1){
while(SensorValue[in1] < 1100){
motor[port6] = motor[port7] = -127;
}
} else if(lit == 2){
while(SensorValue[in1] > 200){
motor[port6] = motor[port7] = 127;
}
}
motor[port6] = motor[port7] = 0;
if(ink == 1){
motor[port8] = motor[port9] = -127;
wait1Msec(inkt);
motor[port8] = motor[port9] = 0;
} else if(ink == 2){
motor[port8] = motor[port9] = 127;
wait1Msec(inkt);
motor[port8] = motor[port9] = 0;
}
while(SensorValue[dgtl1] > 0 && SensorValue[dgtl3] > 0){
motor[port2] = motor[port3] = motor[port4] = motor[port5] = -127;
}
motor[port2] = motor[port3] = motor[port4] = motor[port5] = 0;
dri = false;
drid = 500;
lit = 0;
ink = 0;
inkt = 3000;
SensorValue[dgtl1] = SensorValue[dgtl3] = 0;
}
}