so i'm doing this.... (multiple buttons with 1 analog) Multiple Buttons on 1 analog pin - Exhibition - Arduino Forum
i got it working with 1analog = 10buttons and 30 buttons all in all so that is 3 analog pins used...
all was well and the if-else statement of the code like this....
if (btnSet0 >= 1011) { unitNumber = 1; }
else if (btnSet0 >= 780 && btnSet0 < 820) { unitNumber = 2; }
else if (btnSet0 >= 970 && btnSet0 < 1010) { unitNumber = 3; }
else if (btnSet0 >= 888 && btnSet0 < 928) { unitNumber = 4; }
else if (btnSet0 >= 695 && btnSet0 < 739) { unitNumber = 5; }
else if (btnSet0 >= 583 && btnSet0 < 660) { unitNumber = 6; }
else if (btnSet0 >= 381 && btnSet0 < 421) { unitNumber = 7; }
else if (btnSet0 >= 187 && btnSet0 < 227) { unitNumber = 8; }
else if (btnSet0 >= 85 && btnSet0 < 125) { unitNumber = 9; }
else if (btnSet0 >= 10 && btnSet0 < 52) { unitNumber = 10; }
my problem is i don't know why the values changed, causing some buttons to NOT set it to the unitNumber properly...
is this caused by fluctuating voltages? because my voltage should be stable is the power comes from 12v -> 7805 regulator -> 5v output...
i could try and adjust the range again (3rd time) but at least i need to know what's causing this....