Skip to content

Instantly share code, notes, and snippets.

@jononon
Created November 18, 2015 04:21
Show Gist options
  • Save jononon/9a88dfa5d2eb71d5af47 to your computer and use it in GitHub Desktop.
Save jononon/9a88dfa5d2eb71d5af47 to your computer and use it in GitHub Desktop.
#pragma config(Motor, port1, rightWheel1, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port2, rightWheel2, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port3, rightWheel3, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port4, leftWheel2, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port5, leftWheel3, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port10, leftWheel1, tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#pragma platform(VEX)
//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#include "Vex_Competition_Includes.c" //Main competition background code...do not modify!
void pre_auton() {
bStopTasksBetweenModes = true;
}
task autonomous() {
}
task usercontrol() {
int flipper = 1;
while (true) {
//tank drive
//left wheels
if(abs(vexRT(Ch3))<10) {
motor[leftWheel1] = 0;
motor[leftWheel2] = 0;
motor[leftWheel3] = 0;
} else {
motor[leftWheel1] = vexRT(Ch3)*flipper;
motor[leftWheel2] = vexRT(Ch3)*flipper;
motor[leftWheel3] = vexRT(Ch3)*flipper;
}
//left wheels
if(abs(vexRT(Ch2))<10) {
motor[rightWheel1] = 0;
motor[rightWheel2] = 0;
motor[rightWheel3] = 0;
} else {
motor[rightWheel1] = vexRT(Ch2)*flipper;
motor[rightWheel2] = vexRT(Ch2)*flipper;
motor[rightWheel3] = vexRT(Ch2)*flipper;
}
if(vexRT(7U)) {
flipper*=-1;
while(vexRT(7U)){}
}
//Anywhere from 25-50 Msec pause
wait1Msec(30);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment