-
Notifications
You must be signed in to change notification settings - Fork 5
/
RC_Gurnoor
114 lines (101 loc) · 2.65 KB
/
RC_Gurnoor
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#pragma config(Sensor, in1, gyro, sensorGyro)
#pragma config(Sensor, dgtl1, leftEncoder, sensorRotation)
#pragma config(Sensor, dgtl2, rightEncoder, sensorRotation)
#pragma config(Motor, port1, leftFront, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port2, leftMid, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port3, leftBack, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, rightFront, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port5, rightMid, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port6, rightBack, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port7, leftArm, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, rightArm, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port9, intake, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port10, linLaunch, tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
void leftDrive (int speed)
{
motor[leftFront] = speed;
motor[leftMid] = speed;
motor[leftBack] = speed;
}
void rightDrive (int speed)
{
motor[rightFront] = speed;
motor[rightMid] = speed;
motor[rightBack] = speed;
}
void intakeBall (int speed)
{
motor[intake] = speed;
}
void shootBall (int speed)
{
motor[linLaunch] = speed;
}
void arm(int speed)
{
motor[leftArm] = speed;
motor[rightArm] = speed;
}
task main() //MAIN METHOD
{
int leftSpeed = 0;
int rightSpeed = 0;
int intakeSpeed = 0;
int shootSpeed = 0;
int armSpeed = 0;
while (true)
{
//DRIVE TRAIN - CONTROLLER 1 ----------------------------------------------------------------------------------------------------
if (vexRT[Ch3] < 35 && vexRT[Ch3] > -35)
{
leftSpeed = 0;
}
else
{
leftSpeed = vexRT[Ch3];
}
if (vexRT[Ch1] < 35 && vexRT[Ch1] > -35)
{
rightSpeed = 0;
}
else
{
rightSpeed = vexRT[Ch1];
}
leftDrive(leftSpeed);
rightDrive(rightSpeed);
//ARM,INTAKE,LINEAR LAUNCHER - CONTROLLER 2 --------------------------------------------------------------------------------------
if (vexRT[Btn6UXmtr2] == 1)
{
armSpeed = 127;
}
else if (vexRT[Btn6DXmtr2] == 1)
{
armSpeed = -127;
}
else
{
armSpeed = 0;
}
if (vexRT[Btn5UXmtr2] == 1)
{
intakeSpeed = 127;
}
else
{
intakeSpeed = 0;
}
if (vexRT[Btn5DXmtr2] == 1)
{
shootSpeed = 127;
}
else
{
shootSpeed = 0;
}
arm(armSpeed);
intakeBall(intakeSpeed);
shootBall(shootSpeed);
}
} //end of main method