forked from HerricksRobotics/Vex2019
-
Notifications
You must be signed in to change notification settings - Fork 0
/
firstclaw.rbc
70 lines (65 loc) · 1.57 KB
/
firstclaw.rbc
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
#pragma config(Motor, motor1, rightBack, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, motor2, rightFront, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, motor3, leftBack, tmotorVex393_MC29, openLoop)
#pragma config(Motor, motor4, leftFront, tmotorVex393_MC29, openLoop)
#pragma config(Motor, motor5, arm, tmotorVex393_MC29, openLoop)
#pragma config(Motor, motor6, claw, tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
int leftSpeed;
int rightSpeed;
int armSpeed;
int grabberSpeed;
while (1==1){
//To control the left with channel 3
if (vexRT[Ch3] > -35 && vexRT[Ch3] < 35)
{
leftSpeed = 0;
}
else
{
leftSpeed = vexRT[Ch3];
}
//To control the right with channel 2
if (vexRT[Ch2] > -35 && vexRT[Ch2] < 35)
{
rightSpeed = 0;
}
else
{
rightSpeed = vexRT[Ch2];
}
//Controls arm movement
if (vexRT[Btn6U]==1) {
armSpeed = -60;
grabberSpeed = 0;
}
else if (vexRT[Btn6D]==1) {
armSpeed = 60;
//grabberSpeed = -30;
}
else {
armSpeed = 0;
grabberSpeed = 0;
}
//Controls pinchers movement
if (vexRT[Btn8U]==1)
{
grabberSpeed = 127;
}
else if (vexRT[Btn8D]==1)
{
grabberSpeed = -127;
}
else {
grabberSpeed = 0;
}
motor[leftFront] = leftSpeed;
motor[leftBack] = leftSpeed;
motor[rightFront] = rightSpeed;
motor[rightBack] = rightSpeed;
motor[arm] = armSpeed;
motor[claw] = grabberSpeed;
}
}