Rev Magnetic Limit Switches

Does anyone know of any good resources for programming Rev Robotics’ magnetic switches? I was looking into using them for the next season and wanted to know how easy they were to use from the programming perspective.
Here’s a link for the switches I’m talking about: http://www.revrobotics.com/rev-31-1462/

You would program it as a DigitalInput if its connected to the roboRIO/expansion board:

private DigitalInput limitSwitch = new DigitalInput(DIGITAL_INPUT_PORT);

public boolean getLimitSwitchState() {
    return limitSwitch.get();
}

The thing that may be confusing is that the Rev Mag Limit Switch has two output wires. One is normally open (Returns true when the Mag Limit Switch is triggered by a magnet) and the other is normally closed (Returns true when the Mag Limit switch is not triggered by a magnet). So you just need to wire 3 out of the 4 wires to get it to work. See the data sheet on the webpage to see which wires you need out of the three.

The data sheet seems to suggest both outputs are normally open

1 Like