The value changes when we connect new components to the arduino and therefore we have to update our program coding (if statement). Is there any way to configure the input values from the buttons as digital values instead of analog values, alt, use the other analog ports (A1, A2, A3, A4, A5)
Thank you for reading, and i hope you can help us.
while(beslut==1)//så länge select knappen inte är intryckt
The value changes when we connect new components to the arduino
Sounds like you are using the "default" Vcc (+5Volt) reference... Increasing load may be dropping your supply voltage and giving incorrect/fluctuating A/D readings. If you have a DVM, measure the +5 after the voltage regulator for variations.... Better, use a DC o'scope if available.
Well, clearly if A0 is used for the pushbuttons, you will not be connecting it to any other components, will you?
As the analog read routine returns values only up to 1023, your comparisons in the code cited are not going to be useful at all.
Speaking of code, please go back and select "modify" on your first post, highlight the code section and mark it as such with the "code" ([ # ]) icon above the submission window and re-save it.
As the pushbutton inputs are ratiometric, fluctuations in the supply voltage do not matter.
Also do check that you have a version 1.0 board rather than a 0.01, which earlier board has a really nasty problem with the backlight control explained in the "sticky" up the top of this forum.