Created
January 16, 2019 08:19
-
-
Save pbriggs28/7213f956dd4333c2b64760c579b80e0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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; | |
// } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment