forked from StRobertCHSCS/ICS4U-PCP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack_fail
More file actions
52 lines (51 loc) · 1.6 KB
/
stack_fail
File metadata and controls
52 lines (51 loc) · 1.6 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
#pragma config(Sensor, port2, bumper, sensorVexIQ_Touch)
#pragma config(Sensor, port3, colour, sensorVexIQ_Color12Color)
#pragma config(Motor, motor1, left, tmotorVexIQ, PIDControl, driveLeft, encoder)
#pragma config(Motor, motor6, right, tmotorVexIQ, PIDControl, reversed, driveRight, encoder)
#pragma config(Motor, motor10, lift, tmotorVexIQ, PIDControl, encoder)
#pragma config(Motor, motor11, claw, tmotorVexIQ, PIDControl, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
int count = 0;
while(count != 3)
{
setMultipleMotors(50, left, right);
while(count == 0)
{
while((getColorName(colour) == colorGreen)||(getColorName(colour) == colorRed))
{
forward(180, degrees, 50);
moveMotor(claw, 90, degrees, 50);
moveMotor(lift, 3, rotations, 50);
moveMotor(claw, 90, degrees, -50);
moveMotor(lift, 3, rotations, -50);
count+=1;
}
}
while(count == 1)
{
setMultipleMotors(50, left, right);
while((getColorName(colour) == colorGreen)||(getColorName(colour) == colorRed))
{
forward(180, degrees, 50);
moveMotor(claw, 90, degrees, 50);
moveMotor(lift, 2, rotations, 50);
count+=1;
}
}
while(count == 2)
{
setMultipleMotors(50, left, right);
if(getBumperValue(bumper) == 1)
{
moveMotor(lift, 1, rotations, -50);
moveMotor(claw, 90, degrees, -50);
moveMotor(lift, 2, rotations, 50);
moveMotor(claw, 90, degrees, 50);
moveMotor(lift, 3, rotations, -100);
count+=1;
}
}
}
}