Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void teleopPeriodic() {
- // Set buttonCurr
- // Check if a press JUST started
- // If so, reset timer
- // Check if button is pressed
- // If so, check if we need to reset timer (over 1 second)
- // If not, pulse
- currButton = controller.getRawButtonPressed(1);
- // Change this to use currButton (only to make it more readable, that's all)
- if (controller.getRawButton(1)) {
- // You can just say !prevButton instead of prevButton == false
- if (prevButton == false) {
- timer.start();
- // Don't set this here, instead just set prevButton = currButton at the very end of the method
- prevButton = true;
- }
- // Break out the pulseOn and timer.hasPassed checks into separate if statements, not connected
- // if time.hasPassed()
- // reset timer
- // Toggle pulseOn value
- // if pulseOn
- // set motor output to 0
- // Set talon to motor output
- // Then you shouldn't need anything below here:
- // if (pulseOn) {
- // motorOutput = 0;
- // if (timer.hasPeriodPassed(1)) {
- // pulseOn = false;
- // }
- // } else {
- // motorOutput = 1;
- // if (timer.hasPeriodPassed(1)) {
- // pulseOn = true;
- // }
- //
- // }
- // talon.set(ControlMode.PercentOutput, motorOutput);
- // System.out.println(timer.get());
- // if (timer.hasPeriodPassed(1)) {
- // timer.reset();
- // }
- }
- // if (controller.getRawButtonReleased(1)) {
- // prevButton = false;
- // }
- }
Add Comment
Please, Sign In to add comment