Voltage range acceptance for a divider to detect keystroke

Use a small capacitor on the analog pin to reduce noise from switch-contacts (10nF to
100nF is appropriate.

Always read the analog pin repeatedly till the voltage stabilises - you don't want to
be confused by a transient voltage change during sampling, nor by contact bounce.

You can assume a repeatability of 5 counts or so if the Arduino's supply is stable
and there's aren't any large noise sources like motors.