Quote:
Originally Posted by mtnteam
So in order to wire the limit switch to the Digital I/O who wire it to a PWM cable to only the signal and GND?
|
Exactly! Typically, people will cut the male header of a PWM cable off, tape off the end of the power wire (the middle wire), and then wire the switch to the outer two wires.
As mentioned by others, the limit switch may work opposite of what you expect! Switches can be wired up as "Normally Closed" or "Normally Open". Depending on which way you wire it, you may read TRUE and FALSE either way. Looking at the case of the limit switch that came in the KoP, you'll see the three ports are labeled "Com", "NC", and "NO":
Hook up one wire to Com - it doesn't matter which one.
If you hook the other one up to NC (Normally Closed), then you'll read FALSE when the switch is not pressed, and TRUE when it is.
If you hook it up to NO (Normally Open), you'll read TRUE when the switch is not pressed, and FALSE when it is.
Our programming team always writes a small test program for sensors - essentially, they just read the value and print it to the consol output. This lets them see which way its wired up, and adjust their code as needed.