#pragma config(Sensor, dgtl1, flEncoder, sensorQuadEncoder)
#pragma config(Sensor, dgtl3, frEncoder, sensorQuadEncoder)
#pragma config(Sensor, dgtl5, brEncoder, sensorQuadEncoder)
#pragma config(Sensor, dgtl7, blEncoder, sensorQuadEncoder)
#pragma config(Sensor, dgtl9, liftEncoder, sensorQuadEncoder)
#pragma config(Motor, port2, YMotor, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port3, Y2Motor, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, Y3Motor, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port5, clawMotor, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port6, flMotor, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, blMotor, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, frMotor, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port9, brMotor, tmotorVex393_MC29, 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)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
#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.
bStopTasksBetweenModes = true;
// 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()
{
// Move forward 300 degrees*//
SensorValue[flEncoder] = 0;
SensorValue[frEncoder] = 0;
SensorValue[blEncoder] = 0;
SensorValue[brEncoder] = 0;
while(SensorValue[flEncoder] < 300)
{
if(SensorValue[flEncoder] > SensorValue[frEncoder])
{
motor[frMotor] = 127;
motor[flMotor] = 100;
}
if(SensorValue[frEncoder] > SensorValue[flEncoder])
{
motor[frMotor] = 100;
motor[flMotor] = 127;
}
if(SensorValue[flEncoder] == SensorValue[frEncoder])
{
motor[brMotor] = 127;
motor[blMotor] = 127;
}
if(SensorValue[blEncoder] > SensorValue[brEncoder])
{
motor[brMotor] = 127;
motor[blMotor] = 100;
}
if(SensorValue[brEncoder] > SensorValue[blEncoder])
{
motor[brMotor] = 100;
motor[blMotor] = 127;
}
if(SensorValue[blEncoder] == SensorValue[brEncoder])
{
motor[brMotor] = 127;
motor[blMotor] = 127;
}
}
motor[frMotor] = 0;
motor[flMotor] = 0;
motor[brMotor] = 0;
motor[blMotor] = 0;