Go Down

Topic: Two switches, one pin (Read 671 times) previous topic - next topic

artart

I am trying to use the code in the tutorial at http://www.arduino.cc/en/Tutorial/TwoSwitchesOnePin.

It does not seem to work. When no switches are pressed it reports that switch 1 is pressed. Pressing switch 2 does report properly.

I have tried removing everything except the resistor from pin 2 to ground and it still reports switch 1 is pressed. Does the tutorial code work as advertised? Anyone see and problems with with the code?

Thanks for the help.

Grumpy_Mike

Quote
Does the tutorial code work as advertised?

Well it is not a solid engineering solution that's for sure.
What value do you have for the digital input to ground resistor? Try making it lower.

artart

I tried 200K and 1M but I will go lower and see what happens. Thanks for the suggestion.

Valalvax


I tried 200K and 1M but I will go lower and see what happens. Thanks for the suggestion.


Generally your pullup/down resistor is 10k or so..

artart

The tutorial says use a 10K pull up resistor on one switch and a 200K to 1M resistor from the pin to ground. I tried going all the way down to 50k and no joy. Strange.

Grumpy_Mike

Quote
Use 10k ohm resistor for a better result......

No I think you are missing the point please read the tutorial.

Quote
I tried going all the way down to 50k and no joy.

Then I think you have wired it up wrong.


Go Up