void TeleopPeriodic() { bool button = joystick->GetRawButton(1); if(button && !pButton){ holder->PushBall(); } pButton=button; holder->TeleopPeriodic(); }
void TeleopPeriodic() { bool button = joystick->GetRawButton(2); switch(state){ case WAIT_FOR_BUTTON: if(button && !pButton){ holder->PushBall(); pButton = true; state = CHECK_BALL; } break; case CHECK_BALL: if(holder->CheckPushed()){ state = WAIT_FOR_BUTTON; pButton = false; } break; } holder->TeleopPeriodic(); }