Last active
December 11, 2016 14:55
-
-
Save liamariemb/cfe2afd032affed7cd8c1356afb55dea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma config(Motor, port2, rightMotor, tmotorVex393_MC29, openLoop) | |
#pragma config(Motor, port3, leftMotor, tmotorVex393_MC29, openLoop, reversed) | |
#pragma config(Motor, port6, armMotor, tmotorVex393_MC29, openLoop, reversed) | |
//*!!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[rightMotor] = 40; | |
motor[leftMotor] = 42; | |
wait1Msec(1400); | |
motor[rightMotor] = 0; | |
motor[leftMotor] = 0; | |
wait1Msec(500); | |
motor[armMotor] = -25; | |
wait1Msec(400); | |
motor[armMotor] = 0; | |
wait1Msec(1000); | |
motor[armMotor] = 25; | |
wait1Msec(1200); | |
motor[armMotor] = 0; | |
wait1Msec(500); | |
motor[rightMotor] = -40; | |
motor[leftMotor] = -42; | |
wait1Msec(1400); | |
motor[rightMotor] = 0; | |
motor[leftMotor] = 0; | |
wait1Msec(1000); | |
motor[rightMotor] = 40; | |
motor[leftMotor] = -42; | |
wait1Msec(800); | |
motor[rightMotor] = 0; | |
motor[leftMotor] = 0; | |
wait1Msec(500); | |
motor[rightMotor] = 40; | |
motor[leftMotor] = 42; | |
wait1Msec(3300); | |
motor[rightMotor] = 0; | |
motor[leftMotor] = 0; | |
wait1Msec(500); | |
motor[armMotor] = -25; | |
wait1Msec(400); | |
motor[armMotor] = 0; | |
wait1Msec(1000); | |
motor[armMotor] = 25; | |
wait1Msec(1200); | |
motor[armMotor] = 0; | |
wait1Msec(500); | |
} | |
/*---------------------------------------------------------------------------*/ | |
/* */ | |
/* 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 (true) | |
{ | |
motor[leftMotor] = vexRT[Ch3]; // Left Joystick Y value | |
motor[rightMotor] = vexRT[Ch2]; // Right Joystick Y value | |
if(vexRT[Btn6U] == 1) | |
{ | |
motor[armMotor] = 30; | |
} | |
else if(vexRT[Btn6D] == 1) | |
{ | |
motor[armMotor] = -30; | |
} | |
else | |
{ | |
motor[armMotor] = 0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment