#pragma config(Motor, port1, armMotor, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port2, frontRight, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port3, backRight, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, frontLeft, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port5, backLeft, tmotorVex393_MC29, openLoop, reversed, encoderPort, None)
#pragma config(Motor, port6, beltMotor, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, rotationMotor, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, clawMotor, tmotorVex393_MC29, openLoop, encoderPort, None)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
/*+++++++++++++++++++++++++++++++++++++++++++++| Notes |++++++++++++++++++++++++++++++++++++++++++++
- The left joystick Y-axis controls the robot’s forward and backward movement.
- The left joystick X-axis controls the robot’s left and right movement.
- The right joystick X-axis controls the robot’s rotation.
- The Code incorportes a threshold/deadzone that allows very low Joystick values to be ignored.
This allows the robot to ignore values from the Joysticks when they fail to center at 0,
and provides a margin of error for the driver when they only want the robot to move in one axis.
[I/O Port] [Name] [Type] [Description]
Motor Port 2 frontRight VEX Motor Front Right motor
Motor Port 3 backRight VEX Motor Back Right motor
Motor Port 4 frontLeft VEX Motor Front Left motor
Motor Port 5 backLeft VEX Motor Back Left motor
--------------------------------------------------------------------------------------------------*/
task main()
{
//Loop Forever
while(1 == 1)
{
//Remote Control Commands
motor[frontRight] = vexRT[Ch3] - vexRT[Ch1] - vexRT[Ch4];
motor[backRight] = vexRT[Ch3] - vexRT[Ch1] + vexRT[Ch4];
motor[frontLeft] = vexRT[Ch3] + vexRT[Ch1] + vexRT[Ch4];
motor[backLeft] = vexRT[Ch3] + vexRT[Ch1] - vexRT[Ch4];
}
////________________________________________________________________________________________________________
//above is the code for the wheels which allows wheels to move in a 350 degrees rotation.
if(vexRT[Btn7U] == 1) //If button 7U is pressed...
{
motor[armMotor] = 127; //...raise the arm.
}
else if(vexRT[Btn7D] == 1) //Else, if button 7D is pressed...
{
motor[armMotor] = -127; //...lower the arm.
}
else //Else (neither button is pressed)...
{
motor[armMotor] = 0; //...stop the arm.
}
//////______________________________________________________________________________________________________
//above is the code for the arm which allows it to move up and down
// Open, close or do not more claw
if(vexRT[Btn6U] == 1) //If Button 6U is pressed...
{
motor[clawMotor] = 127; //...close the gripper.
}
else if(vexRT[Btn6D] == 1) //Else, if button 6D is pressed...
{
motor[clawMotor] = -127; //...open the gripper.
}
else //Else (neither button is pressed)...
{
motor[clawMotor] = 0; //...stop the gripper.
}
////_______________________________________________________________________________________________________________
//above is the code for the claw allowing it to open and close
if(vexRT[Btn7L] ==1) //If button 7L is pressed
{
motor[beltMotor] = 127; //Move the Conveyor belt forward
}
else if(vexRT[Btn7R] == 1) //Else, if button 7R is pressed...
{
motor[beltMotor] = -127; //Move the Conveyer belt backwards.
}
else //Else (neither button is pressed)...
{
motor[beltMotor] = 0; //...stop the Belt.
}
////____________________________________________________________________________________________________________
//above is the code for the conveyor belt allowing it to move back and forth
if(vexRT[Btn8R] ==1) //If button 8R is pressed
{
motor[rotationMotor] = 63; //Rotates the claw
}
else if(vexRT[Btn8L] == 1) //Else, if button 8L is pressed...
{
motor[rotationMotor] = -63; //Move the Conveyer belt backwards.
}
else //Else (neither button is pressed)...
{
motor[rotationMotor] = 0; //Dont rotate
}
}