Alright I'm back at this again. I can’t figure out an efficient way to do this. My original solution was:
ButtonHeld con 30
Switch_Routine:
ButtonCnt=0
While Switch=0:Wend
Pause 250
Return
Main:
' display lcd info here
IF Switch=0 Then
GoSub Switch_Routine
IF ButtonCnt>ButtonHeld Then
' change menu option
Else
' increment value
EndIF
EndIF
Goto Main
Timer1 counts how long (100 ms interval) the switch is held. Once the user releases the switch then it would reenter the Main to execute the code. The problem is there is no feedback to the user if the button has been held long enough. The program stays at the While:Wend until the user releases the button. If I jump out of the switch prior to the release of the switch the loop keeps executing the same switch command until the user releases the switch. Remember: the switch is still being held down.
I’m looking for ideas. If the user presses and releases the switch the program would increment value. If the user presses and holds the switch for 3 seconds or more it would change menu options.
Basically I want two buttons in one.
Bookmarks