Quote:
Originally Posted by euhlmann
My code shouldn't do that. Notice how it sets a flag wasAPressed to make sure it doesn't continuously run shifting. Make sure wasAPressed is a member variable, not a local variable
|
Code:
bool shifter_varable = true;
//later in teleopPeriodic
if (driver->GetRawButton(2)){
if (!shifter_varable){
shifter_varable = true;
shifter->Set(shifter->Get() ==
DoubleSolenoid::Value::kReverse ?
DoubleSolenoid::Value::kForward :
DoubleSolenoid::Value::kReverse);
}else{
shifter_varable = false;
}
}
all tho i did the exact same thing except change the name of the wasAPressed to shifter_varable. It still does the exact same thing as before, going hyper-speed switching back and forth.