Welcome to the Parallax Discussion Forums, sign-up to participate.
' suppose button is on p0, with pullup resistor to Vdd
' state machine logic, can be part of a loop executing other tasks.
oldstate VAR bit
newstate VAR bit
activestate VAR bit
oldstate = in0 ' initialize state
newstate = in0
activestate = newstate ^ oldstate & newstate ' active when button is released to high level
oldstate = newstate
IF activestate THEN DEBUG "buttonup",CR
' do other tasks