I am having trouble with getting the input to go low with a 10K resistor that seems to be the recommended value. It seems to float at about 4.2 - 5v whether I have a resistor pulling it down to earth or not.
I have made sure that the internal pullup resistor is disabled using digitalWrite(input, LOW);
If I reverse the logic and enable the internal resistor using digitalWrite(input, HIGH); and pull the input to earth then it works as expected.
I have tried using lower value resistors as pull down which does work but it shouldnt be necessary.
Make it exactly the button sketch and build in the example and get that working. It is simple enough and doesn't take long. When that works make the changes you need and you might be able to answer your own questions. This stuff makes more sense the more you work with it. Personally, I miss wired that the first time and it took me a while to see my mistake.
It is almost certain that there is a wire not making contact like you think it is.
Right... Check the voltage an the resistor itself to make sure it's the same as the voltage on the input pin.
If there is 5V on the resistor, there has to be SOMETHING pulling it up!!!! The internal 20k pull-up with a 10k pull-down would only pull the voltage to about 1/3rd of 5V, so that's not it...
Are you sure that's a 10K resistor?
Make sure that you have not configured that I/O pin as output. (It should be input by default.) And, make sure the pin or resistor are not shorted to anything else.
If everything is wired correctly, the pin is configured as an input, and the input can't be pulled-down by a 10K resistor, maybe your Arduino is damaged or defective?
I've discovered the cause. I was using digital pin 0. When I change to pin 2 it works OK. Pin 0 apparently is used by the USB port (although it still didnt work when I unplugged from my pc and ran it from a PSU)
drpeej:
I've discovered the cause. I was using digital pin 0. When I change to pin 2 it works OK. Pin 0 apparently is used by the USB port (although it still didnt work when I unplugged from my pc and ran it from a PSU)
See. posting your sketch would have shown us you were using pin 0 and we could have explained the 1K ohm pull-up effect the USB serial converter chip applies to pin 0, even if unplugged from a PC.
And we are left to guess at your level of overall experience in these matters. There is a broad range of people asking for help starting with people that have little to no experience other than they read that the Arduino is cool to work with....