Pages: [1]   Go Down
Author Topic: Two switches, one pin  (Read 591 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 514
Posts: 31549
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Georgia, US
Offline Offline
Sr. Member
****
Karma: 4
Posts: 371
Arduino makes my head hurt :(
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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..
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 514
Posts: 31549
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Pages: [1]   Go Up
Jump to: