Code: #pragma config(Motor, port2, rightMotor, tmotorNormal, openLoop, reversed) #pragma config(Motor, port3, leftMotor, tmotorNormal, openLoop) #pragma config(Motor, port6, armMotor, tmotorNormal, openLoop) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main() {
while(1 == 1) //Create an infinite loop, enabling remote control indefinitely { motor[leftMotor] = vexRT[Ch3]; //Set the left motor power equal to the left joystick vertical axis motor[rightMotor] = vexRT[Ch2]; //Set the right motor power equal to the right joystick vertical axis
if(vexRT[Btn6U] == 1) //If the group 6 Up button is pressed... { motor[armMotor] = 40; //...then raise the arm. } else if(vexRT[Btn6D] == 1)//But if the group 6 down button is pressed... { motor[armMotor] = -40; //...then lower the arm. } else //But if no button is pressed... { motor[armMotor] = 0; //...stop the arm. } }
} |