I'd put the debounce BEFORE the nested While:Wend as so...
Otherwise you're not debouncing the original Button-Press and risk running straight through the button-release code.Code:IF PORTB.0 = 0 TOGGLE PORTB.1 ' or PORTB.1=PORTB.1 ^1 PAUSE 50 ' debounce delay WHILE PORTB.0=0 : WEND ' wait 'till button is released ENDIF
Bookmarks