Pnuematics on one button

Hey all

Does anyone know how to program a button so that when I push it one time and my pneumatics close, but when I push it another time and it releases? Sample code would be great.

make a function to flip a boolean and assign it to a buttton.

void flipPneumatics(void) {
  Pneumatic.set(!Pneumatic.value());
}

int main() {
  Controller.Button_.pressed(flipPneumatics);   

  Competition.autonomous(autonomous);
  Comeptition.drivercontrol(usercontrol);
  while(true) {
   wait(100, msec);
  }
}

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.