User:OzzyLaCelle/sandbox

Vex In The Zone Code

//*!!Code automatically generated by 'ROBOTC' configuration wizard              !!*//
 * 1) pragma config(Motor, port1,           left2,         tmotorVex393_HBridge, openLoop, reversed)
 * 2) pragma config(Motor, port2,           right1,        tmotorVex393_MC29, openLoop)
 * 3) pragma config(Motor, port3,           arm1,          tmotorVex393_MC29, openLoop)
 * 4) pragma config(Motor, port4,           arm2,          tmotorVex393_MC29, openLoop)
 * 5) pragma config(Motor, port5,           ,             tmotorVex393_MC29, openLoop)
 * 6) pragma config(Motor, port6,           lift1,         tmotorVex393_MC29, openLoop)
 * 7) pragma config(Motor, port7,           claw1,         tmotorVex393_MC29, openLoop)
 * 8) pragma config(Motor, port8,           claw2,         tmotorVex393_MC29, openLoop)
 * 9) pragma config(Motor, port9,           right2,        tmotorVex393_MC29, openLoop)
 * 10) pragma config(Motor, port10,          left1,         tmotorVex393_HBridge, openLoop)

// This code is for the VEX cortex platform
 * 1) pragma platform(VEX2)

// Select Download method as "competition"
 * 1) pragma competitionControl(Competition)

//Main competition background code...do not modify!
 * 1) 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 {	while (true){ motor(right1)=127; motor(left1)=127; 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 { // User control code here, inside the loop

while (true) {

motor(right1) = vexRT[Ch4] - vexRT[Ch3]; motor(left1) = vexRT[Ch1] + vexRT[Ch2]; motor(right2) = vexRT[Ch4] - vexRT[Ch3]; motor(left2) = vexRT[Ch1] + vexRT[Ch2];

if(vexRT[Btn5U]==1) { motor(arm1)=127; // when btn 5U is pressed the arm lift will go up motor(arm2)=127;

} else if(vexRT[Btn5D]==1) { motor(arm1)=-127; // when btn 5D is pressed the arm lift will go down motor(arm2)=-127;

} else { motor(arm1)=0; // if Btn 5D or Btn 5U is not pressed nothing will happen motor(arm2)=0;

} if (vexRT[Btn6U]==1) {	motor(lift1)=127; // when btn 6U is pressed the lift will go up

} else if(vexRT[Btn6D]==1) {	motor(lift1)=-127; // when Btn 6D is pressed the lift will go down } else {	motor(lift1)=0; // if Btn 6D or Btn 6U is not pressed nothing will happen } if (vexRT[Btn8U]==1) {	motor(claw1)=127; // when Btn 8U is pressed the claw will open motor(claw2)=-127; } else if (vexRT[Btn8D]==1) {	motor(claw1)=-127; // When Btn 8D is pressed the claw will close motor(claw2)=127; } else {	motor(claw1)=0; // if Btn 8D or Btn 8U is not pressed nothing will happen motor(claw2)=0;

}

UserControlCodePlaceholderForTesting; } }