I have 4 Buttons which are connected to one analog input of my Arduino UNO. All Buttons receive the positive input from the +5V line of the Arduino but each has a different resistor before it
Firstly I would have expected much higher differences in the readings, but the main issue is, that sometimes the values also do overlap. Button 1 may provide 1021 but also sometimes 1019, or Button 3 may provide 1019 or 1017 and this holds true for all 4 buttons, the may sometimes overlap
When I look at your resistors, they seem to look to be 33, 47, 56 and 68 ohm. The third band is black, meaning a zero amount of 0. Or your picture is very unclear. But I doubt that.
I do think that you will see a bigger difference when using those. Don't worry about it, you learned something today, always check your components after buying them. When I was still in highschool I roasted 4 74 serie IC's because they dumped them in the wrong container at the store. I drove to the store 4 times (about 12 miles) before I had the sense to check them while in the store. My circuit design was ok.
Is it possible to use a few digital inputs ?
Most analog pins are digital pins as well, in case you don't have enough digital pins.
I never use such a circuit, because I don't like it. When two or more buttons are pressed, it can result into the detection of the wrong button.
Thanks for your advise, Mikeb1970. I will keep that in mind. As for the other comment, unfortunately I need to use this setup, as I only have this 1 analog input pin left All other pins are occupied by SPI, 3 times CS, an IRQ Pin for a player and some LEDs.
You can work this out; change the 10k resistor to 100 ohms (or use 2 56ohms in series = 112, close enough).
How many of those low values did you buy?
If possible, work with what you have there.