I have revised my code to:
do
If Pinb.4 = 0 Then
waitms 2
incr sbounce
If sbounce > = 28 Then '
'do stuff because with has been held at least 56ms
End If
If pinb.4 =1 then
' button has been released before count is up
sbounce = 0 'reset sbounce
' do different stuff while switch is open
end if
loop
↧