-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathteleopkabelo.c
52 lines (44 loc) · 1.58 KB
/
teleopkabelo.c
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(Hubs, S1, HTMotor, HTMotor, none, none)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Motor, mtr_S1_C1_1, rightMotor, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C1_2, intakeMotor, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C2_1, motorF, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C2_2, motorG, tmotorTetrix, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c" //Include file to "handle" the Bluetooth messages.
static const int ARM_MOTOR_SPEED = 75
static const int INTAKE_MOTOR_SPEED = 90
static const int LATCH_BUTTON = 1
static const int RAISE_ARM_BTN = 6
static const int LOWER_ARM_BTN = 8
void initializeRobot()
{
nMotorEncoder[armMotor] = 0 // Resets position of armMotor encoder to zero before any commands
motor[intakeMotor] = 90
return;
}
task main()
{
initializeRobot();
waitForStart(); // wait for start of tele-op phase
while (true) {
getJoystickSettings(joystick);
if (joy1Btn(LATCH_BUTTON) == 1) {
servo[latchServo] == ...
}
else if (joy1Btn(RAISE_ARM_BUTTON) == 1) {
motor[intakeMotor] = 0
while (nMotorEncoder[armMotor] < ...) {
motor[armMotor] = ARM_MOTOR_SPEED
}
motor[intakeMotor] = INTAKE_MOTOR_SPEED
}
else if (joy1Btn(LOWER_ARM_BUTTON) == 1) {
motor[intakeMotor] = 0
while (nMotorEncoder[armMotor] > ...) {
motor[armMotor] = -ARM_MOTOR_SPEED
}
motor[intakeMotor] = INTAKE_MOTOR_SPEED
}
}
}