This task should never exit; it should end with some kind of infinite loop, even if empty.
*/
void operatorControl() {
// Motor Deceleration for readability
int front_left = 1;
int back_left = 2;
int back_right = 3;
int left_arm = 4;
int right_arm = 5;
int front_right = 10;
while (true){
//Threshold value deceleration
int TH = 15;
int y1;
int y2;
bool is_locked = false;
if(joystickGetDigital(1, 7, JOY_UP) == true){
motorSet(4, 100);
motorSet(5, 100);
}
if(joystickGetDigital(1, 7, JOY_DOWN) == true){
motorSet(left_arm, -100);
motorSet(right_arm, -100);
}
// Checks if the threshold for deadzones is exceeded
if(TH <= abs(joystickGetAnalog(1, 3))){
y1 = joystickGetAnalog(1, 3);
}
else if (TH >= abs(joystickGetAnalog(1, 3))){
y1 = 0;
}
if (TH <= abs(joystickGetAnalog(1, 2))){
y2 = joystickGetAnalog(1, 2);
}
else if (TH >= abs(joystickGetAnalog(1, 2)) ){
y2 = 0;
}
//Sets motor values based on wether or not the value has been exceeded
motorSet(front_left, y1);
motorSet(back_left, y1);
motorSet(front_right, y2);
motorSet(back_right, y2);
//Locks and unlocks motors
if(joystickGetDigital(1, 8, JOY_UP)){
motorSet(left_arm, 100);
motorSet(right_arm, 100);
}
/*
else if(joystickGetDigital(1, 8, JOY_UP) && is_locked == true){
motorSet(left_arm, 0);
motorSet(right_arm, 0);
}
if(is_locked == true){
motorSet(left_arm, 10);
motorSet(right_arm, 10);
}
if(joystickGetDigital(1, 8, JOY_LEFT)){
motorSet(left_arm, -50);
motorSet(right_arm, -50);
}
if(joystickGetDigital(1, 8, JOY_RIGHT)){
motorSet(left_arm, 50);
motorSet(right_arm, 50);
}
else{
motorSet(left_arm, 0);
motorSet(right_arm, 0);
}
*/
}
}