' {$STAMP BS2} ' {$PBASIC 2.5} state var bit switch con 7 'debug "Testing" 'check: debug dec in7 ' pause 250 ' goto check state = in7 loop1: if state = in7 then goto loop1 ' no change? endif state = in7 ' record state if in7 = 1 then debug "OFF" elseif in7 = 0 then debug "ON" endif goto loop1