Coding Question
wonka
Posts: 12
Hello, I am having a problem with coding. I am trying to use a switch as a input but I but I want it to go back to the·main of the code. The tricky part is I can not get it to turn off, or go to the main·of the code if i change my switch state. It finish my loop then turns off. I just want it to turn off or go back to the main untill it on again.
Thanks alot
Adam
Thanks alot
Adam
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
·· On the input the switch is either tying the line high or low...But what's pulling the pin the other direction?· In other words, if your switch is active low, you should have a 10K pull-up resistor tied from the pin to Vdd (+5V).· If the switch is active high, you should have a 10K pull-down resistor going from the pin to Vss (Ground).· Without this the pin will float.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com