within loop based programming.md, code could be changed to
//check the blue limit switch
if(!backwardSwitch.get()) {
//This switch has been pressed (or unplugged)
isForwardDirection = false;
}
//check the red limit switch
if(!forwardSwitch.get()) {
//this switch has been pressed (or unplugged)
isForwardDirection = true;
}
//Secondly Move the duck motor based on the current forward direction
if(isForwardDirection ) {
//move the duck in the forward direction
motor.set(ControlMode.PercentOutput, 0.3f);
} else {
//move the duck in the backwards direction
motor.set(ControlMode.PercentOutput, -0.3f)
}
== false could be replaced with ! for code concision and clarity :)
within loop based programming.md, code could be changed to
== false could be replaced with ! for code concision and clarity :)