Use large resistors - 1k to 10k. You don't need much current to detect a closed switch.
Even better, skip the external pullup resistor altogether, and use the ATmega's internal pullup (which is enabled bit writing a 1 to the pin after it has been set as an input).
I tried using 1k, 10k and then setting the inputs to 1 initially.
None of these worked... couldn't even make one button work with the 10k resistors
The setup detects the logic LOW -- so I think that running four at once is too much. Even with the large resistors I still just get strange errors with the other resistor setups with just one button.
Any thoughts?
Worked like a charm with the 300 ohm resistors with a single / double button. Anything more and there would be complete loss of functionality.
Hi,
One thought, the pins can have dual use.
Digital IO pins 0 and 1 are connected to the USB serial via 1k, that can be a reason you needed low values of the resistors and 10k did not work.
Look at the schematic and use some IO-ports that are not connected to anything.
I think they are still 'using' too much power...
Any thoughts?
Got any evidence to support that theory?
I'll say it again, for low power consumption and the simplest circuit, just use the internal pullups.
Button logic is often inverted, because it frequently works out the easiest to pull the line up to Vcc. Just deal with it in software. On occasion I have even created #defines for ENABLED and DISABLED to save myself confusion with active low signals (especially on a system that has active low peripherals and active high peripherals). e.g.:
void loop(){
up = digitalRead(upPin);
down = digitalRead(downPin);
left = digitalRead(leftPin);
right = digitalRead(rightPin);
//begin right
if (right == LOW) {
....
if (left == LOW) {
.... etc. etc. etc.
etc. etc.
The buttons do not respond.. and my test LED on board is pretty dim.. instead of bright orange.. any ideas?