#pragma config(Motor, port1, LeftIntake, tmotorNormal, openLoop)
#pragma config(Motor, port2, Drive1, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port3, Drive2, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port4, Drive3, tmotorNormal, openLoop)
#pragma config(Motor, port5, Drive4, tmotorNormal, openLoop)
#pragma config(Motor, port6, TopLeftLift, tmotorNormal, openLoop)
#pragma config(Motor, port7, BottomLeftLift, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port8, TopRightLift, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port9, BottomRightLift, tmotorNormal, openLoop)
#pragma config(Motor, port10, RightIntake, tmotorNormal, openLoop, reversed)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
#pragma platform(VEX)
//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120)
#include “Vex_Competition_Includes.c” //Main competition background code…do not modify!
void pre_auton()
{
}
task autonomous()
{
motor[port6] = 127;
motor[port7] = 127;
motor[port8] = 127;
motor[port9] = 127;
wait1Msec(2000);
//LIft goes up
motor[port2] = 127;
motor[port3] = 127;
motor[port4] = 127;
motor[port5] = 127;
wait1Msec(1000);
//Drive Forward to Big Ball
motor[port2] = -127;
motor[port3] = -127;
motor[port4] = -127;
motor[port5] = -127;
wait1Msec(500);
//Move Back Slightly
motor[port2] = 127;
motor[port3] = 127;
motor[port4] = -127;
motor[port5] = -127;
wait1Msec(500);
//Turn Left
motor[port2] = 127;
motor[port3] = 127;
motor[port4] = 127;
motor[port5] = 127;
wait1Msec(1000);
//Move Forward
motor[port2] = -127;
motor[port3] = -127;
motor[port4] = 127;
motor[port5] = 127;
wait1Msec(500);
//Turn Right
motor[port2] = 127;
motor[port3] = 127;
motor[port4] = 127;
motor[port5] = 127;
wait1Msec(1000);
//Move Forward Knock Down Second Big Ball
motor[port2] = -127;
motor[port3] = -127;
motor[port4] = -127;
motor[port5] = -127;
wait1Msec(500);
//Move Back Slightly
motor[port6] = -127;
motor[port7] = -127;
motor[port8] = -127;
motor[port9] = -127;
wait1Msec(2000);
//Bring Lift Down
motor[port2] = 127;
motor[port3] = 127;
motor[port4] = 127;
motor[port5] = 127;
wait1Msec(1000);
//Drive under bridge
motor[port2] = -127;
motor[port3] = -127;
motor[port4] = 127;
motor[port5] = 127;
wait1Msec(250);
//Turn Right 45 degrees
motor[port6] = 127;
motor[port7] = 127;
motor[port8] = 127;
motor[port9] = 127;
wait1Msec(2000);
//Bring Lift Up
motor[port2] = -127;
motor[port3] = -127;
motor[port4] = -127;
motor[port5] = -127;
wait1Msec(500);
//Move forward to Goal
motor[port1] = 127;
motor[port10] = 127;
wait1Msec(2000);
//Spit out Bucky Pre Load
AuonomousCodePlaceholderForTesting(); // Remove this function call once you have "real" code.
}
task usercontrol()
{
motor[Drive1] = vexRT[Ch2];
motor[Drive2] = vexRT[Ch2];
motor[Drive3] = vexRT[Ch3];
motor[Drive4] = vexRT[Ch3];
{
//Lift
if(vexRT[Btn5U] == 1) //If button 5U is pressed:
{
motor[port6] = 127; //lift arm
motor[port7] = 127;
motor[port8] = 127;
motor[port9] = 127;
}
else if(vexRT[Btn5D] == 1) //If button 5D is pressed:
{
motor[port6] = -127; //go down
motor[port7] = -127;
motor[port8] = -127;
motor[port9] = -127;
}
else //If neither buttons 5U or 5D are pressed:
{
motor[port6] = 0; //stop motor port 5
motor[port7] = 0;
motor[port8] = 0;
motor[port9] = 0;
//Intake
if(vexRT[Btn6U] == 1) //If button 6U is pressed:
{
motor[port1] = 127; //Take In
motor[port10] = -127;
}
else if(vexRT[Btn6D] == 1) //If button 6D is pressed:
{
motor[port1] = -127; //Spit Out
motor[port10] = 127;
}
else //If neither buttons 6U or 6D are pressed:
{
motor[port1] = 0; //stop motor port 5
motor[port10] = 0;
// This is the main execution loop for the user control program. Each time through the loop
// your program should update motor + servo values based on feedback from the joysticks.
// .....................................................................................
// Insert user code here. This is where you use the joystick values to update your motors, etc.
// .....................................................................................
UserControlCodePlaceholderForTesting(); // Remove this function call once you have "real" code.
}
}
}
}