Skip to content

Instantly share code, notes, and snippets.

@1oonie
Created February 9, 2023 13:18
Show Gist options
  • Save 1oonie/e1e9920b517c08c473055c6a3afc9174 to your computer and use it in GitHub Desktop.
Save 1oonie/e1e9920b517c08c473055c6a3afc9174 to your computer and use it in GitHub Desktop.
#pragma config(Motor, port3, br, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, fl, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port5, belt, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, bl, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port9, fr, tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#define activation_energy 40
void left_(int a) {
motor[fl] = a;
motor[bl] = a;
}
void right_(int a) {
motor[fr] = a;
motor[br] = a;
}
task main()
{
bool belting = false;
while (true) {
if (abs(vexRT[Ch3]) >= 40) {
left_(vexRT[Ch3]);
}
if (abs(vexRT[Ch2]) >= 40) {
right_(vexRT[Ch2]);
}
if (vexRT[Btn5U]) {
belting = !(belting);
}
if (belting) {
motor[belt] = 127;
} else {
motor[belt] = 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment