Lots of Button and Leds and Analog Value Range Problem

I use 4 analog input and for each analog input I use 5 button. I use AnalogRead() commend and control which button has which analog value range but each 2 or 3 second this range changes so i cant build the circuit as I want how can i fix this analog value range problem.

Guys if anyone knows can you answer it because this is my important homework project, thanks.

I think this is what you’re after to get a range of analogRead() values from multiple buttons on a single pin. Feed 5V to all the buttons’ high-side, then connect each button to the analog pin of your choice using a range of series resistors, then tie the whole line to ground using a 10K resistor.

In the attached schematic, that would mean R1-R5 would each have a unique resistor value, and R6 is the 10K pull-down to keep the pin from floating.


yeah man i understand you but my problem is about analog value range my curcuit schematic is true but when i put a led the analogread output value changes so i found a relationship between adding more leds and analog output value i fixed that thanks tho.

A real picture would have been better than a Fritzing image.

Post your code (inside code tags).
Read the forum rules first.