At current stage, I'm looking for more efficient and small code
for ADC key handling.
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 21:40.
Yes and we again will have extra "left" and "right" variables, one per each button - what I wanted to avoid![]()
maybe I am a bit slow.. But how you can have 40 buttons but not 40 variables to distinct between them?
Ioannis
ADCIN X,ADVAL
IF ADVAL=20 then Gosub Y1
IF ADVAL=10 then GOSUB Y2
IF ADVAL=30 then GOSUB Y3
and so on.
Bookmarks