By clever selection of ADC resistors.
This had been solved long time ago, and not by me![]()
By clever selection of ADC resistors.
This had been solved long time ago, and not by me![]()
Recent posts got me thinking. Are you designing something with a bunch of buttons, each with a specific functionality? Or are you trying to do something more akin to a key pad? If you're using a standard key pad there are set-ups using resistors to create a narrow voltage range with the press of any individual key. That only requires one analog input to read any key press.
https://aws1.discourse-cdn.com/ardui...2_542x500.jpeg
12 buttons is ok with 8 bit adc . with 16 the last row gets down to 2 or 3 counts separation , a bit close for comfort in my view
Warning I'm not a teacher
At current stage, I'm looking for more efficient and small code
for ADC key handling.
Doesn't post#2 with the use of Select Case do what you want with the least code/var usage?
Ioannis
No it does not.
It does not do "do not repeat action until user releases and pushes key again"
Something like that then?Code:if !flag then adcin 1, adcval 'read keys SELECT CASE adcval CASE < 10 : left=left+1:flag=1 'detect button presses CASE < 100 @ NOP CASE < 130 : right=right+1 :flag=1'detect button presses END SELECT endif
Ioannis
Last edited by Ioannis; - 7th January 2022 at 20:40.
Bookmarks