#pragma config(Motor, port2, frontRightMotor, tmotorVex393_MC29, openLoop, reversed, driveRight)
#pragma config(Motor, port3, frontLeftMotor, tmotorVex393_MC29, openLoop, driveLeft)
#pragma config(Motor, port9, backLeftMotor, tmotorVex393_MC29, openLoop, driveLeft)
#pragma config(Motor, port8, backRightMotor, tmotorVex393_MC29, openLoop, reversed, driveRight)
#pragma config(Motor, port7, clawMotor, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port6, armMotor1, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, armMotor, tmotorVex393_MC29, openLoop)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
/---------------------------------------------------------------------------/
/* /
/ Description: Competition template for VEX EDR /
/ /
/---------------------------------------------------------------------------*/
// This code is for the VEX cortex platform
#pragma platform(VEX2)
// Select Download method as “competition”
#pragma competitionControl(Competition)
//Main competition background code…do not modify!
#include “Vex_Competition_Includes.c”
/---------------------------------------------------------------------------/
/* Pre-Autonomous Functions /
/ /
/ You may want to perform some actions before the competition starts. /
/ Do them in the following function. You must return from this function /
/ or the autonomous and usercontrol tasks will not be started. This /
/ function is only called once after the cortex has been powered on and /
/ not every time that the robot is disabled. /
/---------------------------------------------------------------------------*/
void pre_auton()
{
// Set bStopTasksBetweenModes to false if you want to keep user created tasks
// running between Autonomous and Driver controlled modes. You will need to
// manage all user created tasks if set to false.
bStopTasksBetweenModes = true;
// Set bDisplayCompetitionStatusOnLcd to false if you don't want the LCD
// used by the competition include file, for example, you might want
// to display your team name on the LCD in this function.
// bDisplayCompetitionStatusOnLcd = false;
// All activities that occur before the competition starts
// Example: clearing encoders, setting servo positions, …
}
/---------------------------------------------------------------------------/
/* /
/ Autonomous Task /
/ /
/ This task is used to control your robot during the autonomous phase of /
/ a VEX Competition. /
/ /
/ You must modify the code to add your own robot specific commands here. /
/---------------------------------------------------------------------------*/
task autonomous()
{
motor(backLeftMotor) = -127;
motor(backRightMotor) = -127;
motor(frontLeftMotor) = -127;
motor(frontRightMotor) = -127;
wait1Msec(500);
motor(backLeftMotor) = 0;
motor(backRightMotor) = 0;
motor(frontLeftMotor) = 0;
motor(frontRightMotor) = 0;
wait1Msec(1000);
motor(backLeftMotor) = -127;
motor(backRightMotor) = 0;
motor(frontLeftMotor) = -127;
motor(frontRightMotor) = 0;
wait1Msec(1800);
motor(backLeftMotor) = 0;
motor(backRightMotor) = 0;
motor(frontLeftMotor) = 0;
motor(frontRightMotor) = 0;
wait1Msec(1000);
motor(backLeftMotor) = -127;
motor(backRightMotor) = -127;
motor(frontLeftMotor) = -127;
motor(frontRightMotor) = -127;
wait1Msec(2500);
motor(backLeftMotor) = 0;
motor(backRightMotor) = 0;
motor(frontLeftMotor) = 0;
motor(frontRightMotor) = 0;
wait1Msec(1000);
AutonomousCodePlaceholderForTesting();
}
/---------------------------------------------------------------------------/
/* /
/ User Control Task /
/ /
/ This task is used to control your robot during the user control phase of /
/ a VEX Competition. /
/ /
/ You must modify the code to add your own robot specific commands here. /
/---------------------------------------------------------------------------*/
task usercontrol()
{
while(1==1)
{
motor[backRightMotor] = vexRT[Ch2];
motor[frontRightMotor] = vexRT[Ch2];
motor[frontLeftMotor] = vexRT[Ch3];
motor[backLeftMotor] = vexRT[Ch3];
if(vexRT[Btn6U] == 1) //If button 5U is pressed…
{
motor[armMotor] = 127; //…raise the arm.
}
else if(vexRT[Btn6D] == 1) //Else, if button 5D is pressed…
{
motor[armMotor] = -127; //…lower the arm.
}
else //Else (neither button is pressed)…
{
motor[armMotor] = 0; //…stop the arm.
}
if(vexRT[Btn6U] == 1) //If button 5U is pressed…
{
motor[armMotor1] = 127; //…raise the arm.
}
else if(vexRT[Btn6D] == 1) //Else, if button 5D is pressed…
{
motor[armMotor1] = -127; //…lower the arm.
}
else //Else (neither button is pressed)…
{
motor[armMotor1] = 0; //…stop the arm.
}
// Open, close or do not more claw
if(vexRT[Btn5U] == 1) //If Button 6U is pressed…
{
motor[clawMotor] = 127; //…close the gripper.
}
else if(vexRT[Btn5D] == 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.
}
}
}