Code: #pragma config(Motor, port1, , tmotorVex393, openLoop, reversed) #pragma config(Motor, port9, , tmotorVex393, openLoop, reversed) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
//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!
///////////////////////////////////////////////////////////////////////////////////////// // // Pre-Autonomous Functions // // You may want to perform some actions before the competition starts. Do them in the // following function. // /////////////////////////////////////////////////////////////////////////////////////////
void pre_auton() { // Set bStopTasksBetweenModes to false if you want to keep user created tasks running between // Autonomous and Tele-Op modes. You will need to manage all user created tasks if set to 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[port1] = 50; motor[port10] = 50; wait10Msec(1000);
motor[port1] = 50; motor[port10] = -50; wait10Msec(1000);
motor[port1] = -50; motor[port10] = 50; wait10Msec(1000);
motor[port1] = -100; motor[port10] = 100; wait10Msec(1000);
motor[port1] = 50; motor[port10] = 50; wait10Msec(2000);
motor[port1] = 50; motor[port10] = -50; wait10Msec(1000); }
///////////////////////////////////////////////////////////////////////////////////////// // // 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[port1] = vexRT[Ch2] / 2; motor[port10] = vexRT[Ch3] / 2;
//Arm Control if(vexRT[Btn6U] == 1) { motor[port2] = 125; motor[port9] = 125; } else if(vexRT[Btn6D] == 1) { motor[port2] = -125; motor[port9] = -125; } else { motor[port2] = 0; motor[port9] = 0; } } }
|