How do you program limit switches?
I am not the programmmer, but I am the electrician on our team. A limit switch plugs into a digital I/O port on the controller. The switch is closed when the negative is applied (or so I believe and please correct me if I’m wrong). As far as the programming, I have no idea. So it uses the black and white wires of a PWM cable. When the switch is closed, the program is supposed to respond.
yes, we knew that. We need to program it. Thank you, though.
JWS,
When the switch is closed, you will read a 0 and then the switch is open, you will read a 1…
if (rc_dig_in15 == 0)
{
// This will execute when the signal on input 15 is grounded.
}
else
{
// This will execute otherwise (when the switch is open).
}
Does this make sense?
Mike
Yes Thanks very much!
#define leftLS rc_dig_in15
#define rightLS rc_dig_in14
if(leftLS == 0)
//the left limit switch is on
//dont turn left any more
if(rightLS == 0)
//the right limit switch is on
// dont turn right any more
//this post made more since before the nevermind
Thanks anyway!