The code I posted should do exactly with that, with the advantage that the section of code you're currently in will continue to run UNTIL you release the button. What you're proposing will HANG the current program section until you release the button. But here you go:
Code:
code1:
if button=0 then 'check if button is pressed
PAUSE 5 'allow some contact bounce
WHILE button=0 : WEND 'wait for it to be released
PAUSE 5 'allow some contact bounce
goto code2
ENDIF
'somecode here
goto code1
code2:
if button=0 then
WHILE button = 0 : WEND
goto code1
ENDIF
'somecode here
goto code2
and obviously, button is a reserved word.
Bookmarks