Due to my lack of knowledge, when facing same problem, I did the following - while user keeps button pressed, value of needed variable is being increased and value of waiting variable reset. As user releases the button, waiting variable is being increased, and after it reaches some value (say for 2 seconds), next chunk of code is required. I'd like to do the same with long press, but still can't figure how.
Any ideas to add long press detection to this code?
Code:setuploop: if but2=0 then dlycnt=dlycnt+1 'increase debounce variable while button is pressed pause 1 endif if BUT2=1 and dlycnt>100 then 'if button pressed long enough dlycnt=0 high buz 'enable buzzer pin menuitem=menuitem+1 lcdout $fe,1, #menuitem, " pressed " pause 5 low buz 'disable buzzer endif goto setuploop




Bookmarks