All buttons share one analog pin, A0. Each press gives a different value, so print them and set your own thresholds.
What the message means
A resistor ladder gives each button its own voltage. Values differ between shield makers.
Fix it in this order
- Print analogRead(A0) while you press each button.
- Set threshold ranges around the values you see.
- Do not use A0 for another sensor with the shield fitted.
- Debounce by waiting until the button is released.
- Check the shield is seated and the pins are not bent.
- Check the LCD pins that the shield uses do not clash with your other wiring.
Why it happens
The shield wires its buttons as a resistor ladder into the single analog input A0. Each press gives a different voltage, and analogRead returns a number you can match to a button. The resistor values and the supply differ between makers, and the readings shift a little with tolerance, so measure your own numbers and set thresholds between them.
The same shield normally uses digital pins 4 to 9 for the LCD and pin 10 for the backlight, so check your shield’s documentation before wiring other parts to those pins.
If you see this, do this
| You see | Do this |
|---|---|
| Wrong button detected | Thresholds do not match. |
| No change on press | Shield seating or pin A0. |
Related
LCD blank, analogRead settling.
Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.
Why this happens
The five buttons on the shield share the single analog input A0 through a resistor ladder. Each button creates a different voltage divider, so analogRead returns a different number for each. Releasing all buttons leaves the pin near the top of the range, close to 1023.
Resistor tolerance and the supply voltage move these numbers a little, and shield makers choose different resistors. Numbers copied from a tutorial can be off for your shield. Exact comparisons then fail, while comparisons with ranges keep working.
How to confirm the cause
- Upload a short sketch that prints analogRead(A0) about ten times a second and press each button in turn. Write down the numbers.
- With no button pressed the number should be near 1023. If it is not, check that A0 is not used by another wire.
- Hold one button and watch the number. A small steady spread is normal; a large spread points to a poor contact.
- Compare your numbers with the thresholds in the sketch you copied.
- Check the shield documentation for which digital pins the LCD uses.
Worked example
One common version reads roughly 0, 144, 329, 504 and 741 for right, up, down, left and select. Your numbers may differ, so use the midpoints of what you measured.
int readButton() {
int v = analogRead(A0);
if (v < 50) return 1; // right
if (v < 250) return 2; // up
if (v < 450) return 3; // down
if (v < 650) return 4; // left
if (v < 850) return 5; // select
return 0; // none
}Common mistakes
- Comparing with exact values using ==.
- Not waiting for the button to be released, so one press repeats.
- Using A0 for a sensor while the shield is fitted.
- Wiring other parts to the digital pins the LCD uses.
- Assuming a shield for one board works the same on a Mega without checking.
If this did not fix it
- LCD pin conflict. Another part on the same pins leaves the display blank or garbled.
- A different shield version where the buttons are on another analog pin.
- A weak supply, which moves every analog reading.