-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jan7Code
75 lines (72 loc) · 1.55 KB
/
Jan7Code
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
#pragma config(Sensor, dgtl1, armMax, sensorDigitalIn)
#pragma config(Motor, port1, rightDrive, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port3, claw, tmotorServoContinuousRotation, openLoop)
#pragma config(Motor, port4, arm, tmotorServoContinuousRotation, openLoop)
#pragma config(Motor, port10, leftDrive, tmotorVex393_HBridge, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
int cutoff = 27.5;
bool prevDown = false;
while(1==1)
{
if (vexRT[Ch2] > cutoff || vexRT[Ch2] < -cutoff)
{
motor[leftDrive] = vexRT[Ch2] / 2;
motor[rightDrive] = vexRT[Ch2] / 2;
}
else if (vexRT[Ch1] > cutoff)
{
motor[leftDrive] = vexRT[Ch1] / 2;
motor[rightDrive] = -vexRT[Ch1] / 2;
}
else if (vexRT[Ch1] < -cutoff)
{
motor[leftDrive] = vexRT[Ch1] / 2;
motor[rightDrive] = -vexRT[Ch1] / 2;
}
else
{
motor[leftDrive] = 0;
motor[rightDrive] = 0;
}
if(vexRT[Btn5U])
{
motor[arm] = -63.5;
}
else if(vexRT[Btn5D] && SensorValue[armMax] == 1)
{
motor[arm] = 63.5;
prevDown = true;
}
else
{
if(prevDown)
{
motor[arm] = -63.5;
wait1Msec(35);
prevDown = false;
}
motor[arm] = -10;
}
if(SensorValue[armMax] == 0)
{
motor[arm] = -63.5;
wait1Msec(100);
motor[arm] = 0;
wait1Msec(500);
}
if(vexRT[Btn6U])
{
motor[claw] = -63.5;
}
else if(vexRT[Btn6D])
{
motor[claw] = 63.5;
}
else
{
motor[claw] = 0;
}
}
}