Quote:
Originally Posted by euhlmann
Code:
bool wasAPressed = false;
// then in in teleopPeriodic...
if (driver->GetRawButton(2)) {
if (!wasAPressed) {
wasAPressed = true;
shifter->Set(shifter->Get() == DoubleSolenoid::Value::kReverse ? DoubleSolenoid::Value::kForward : DoubleSolenoid::Value::kReverse);
}
} else {
wasAPressed = false;
}
|
The one problem with this code is that when i press the button longer than 1/50th of a second(50 cycles per second the rio reads the code), it hastily switches back and forth between on and off. Is there any way of fixing the problem or do i just need to have extremely fast fingers for that button.
Thx.