' {$STAMP BS2} ' {$PBASIC 2.5} state var bit switch con 7 'debug "Testing" 'check: debug dec in7 ' pause 250 ' goto check state = in7 do if state <> in7 then ' only if a change has occurred state = in7 ' record state if in7 = 1 then debug "OFF" elseif in7 = 0 then debug "ON" endif endif loop