Hello!
I’ve been having one hell of an issue, I’ve shown everyone I can and they can’t find anything wrong with this code. It’s just a test project so I didn’t put it in competition format, plus having main in an infinite loop worked fine up until I started trying to add the vision sensor into the mix, now the code won’t work when it’s the original. I’ve tried simplifying it and it just doesn’t want to budge, I’ve tried deleting the build folder, creating a new project and moving them over, updating the brain, and rebooting the application.
What seems to be the issue?
// Global Variables
motor_group Flywheel = motor_group(Fly1, Fly2, Fly3);
pneumatics Piston1 = pneumatics(Brain.ThreeWirePort.A);
pneumatics Piston2 = pneumatics(Brain.ThreeWirePort.B);
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
Piston1.close();
Piston2.close();
// Main Method
while (1) {
// Pneumatic Controls
if (Controller1.ButtonA.pressing()) {
Piston1.open();
Piston2.open();
}
else if (Controller1.ButtonX.pressing()) {
for (int Counter = 0; Counter <= 4; Counter++) {
Piston1.open();
Piston2.open();
wait(100, msec);
Piston1.close();
Piston2.close();
wait(500, msec);
}
}
else if (Controller1.ButtonL2.pressing()) {
Piston1.open();
} else if (Controller1.ButtonR2.pressing()) {
Piston2.open();
} else {
Piston1.close();
Piston2.close();
}
// Flywheel Controls
if (Controller1.ButtonUp.pressing()) {
Flywheel.spin(forward, 100, pct);
}
else if (Controller1.ButtonDown.pressing()) {
Flywheel.spin(forward, 10, pct);
}
// Emergency Shut-off
if (Controller1.ButtonB.pressing()) {
Flywheel.stop(coast);
}
// Prevents wasted resources
wait(20, msec);
}
}