detect the out put of a limit switch
EvilMaro
Posts: 27
I got my education board yesterday and i try to trouble shot to see what is the input to my pin1
below·is my program
Do
debug"Pin1 = ",dec1,in1
loop
i try to use these command to detect the out put of a limit switch but it is very unstable (sometime high and sometime low).
My switch is normal closed so by logic if there is no contact it should give a logic 1.
i connect my switch from a 5v source to a 10k resistor then to my pin.
pls advise
Thx
Post Edited By Moderator (Chris Savage (Parallax)) : 5/25/2007 2:17:20 PM GMT
below·is my program
Do
debug"Pin1 = ",dec1,in1
loop
i try to use these command to detect the out put of a limit switch but it is very unstable (sometime high and sometime low).
My switch is normal closed so by logic if there is no contact it should give a logic 1.
i connect my switch from a 5v source to a 10k resistor then to my pin.
pls advise
Thx
Post Edited By Moderator (Chris Savage (Parallax)) : 5/25/2007 2:17:20 PM GMT
Comments
Depending on what kind of limit switch you are using, you may be seeing contact bounce. I beleive there is a section in the PBASIC Reference Manual which discusses contact bounce and how to supress it. As I remember, it's in the area of the BUTTON command.
Additionally, since any pin port can only have one of two values (0 or 1) you may want to make the following change:
FROM -
debug"Pin1 = ",dec1,in1
TO -
debug"Pin1 = ",BIN1,in1
or
DEBUG ?, BIN1, IN1
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔