Limit Switch Problems

Team 4239

We are having problems with limit switch readings. Only the switch connected on the lowest DIO port will react when it is pressed (true/false). The other switch that is connected (but not on the lowest DIO port) will return false but will not return true when pressed (it will continue returning false). Both limit switches work fine as we tested them by swapping their ports. All the ports work fine as we also moved them to different ports.

This is our java code (develop).

Reading through your code I can’t really see any issues

What id recommend doing is:

  1. verify your pluging into the ports you think you are
  2. writing the state of both limit switches to the smart dashboard in each subsystems periodic function (see code example)
  3. trying other Ports other than 0 or 1
// ... some subsystem
@Override
public void periodic() {
    SmartDashboard.putBoolean("Up Limit Switch", mLimitUp.get());
}

Thanks, we ended up doing the third option.