Buzby
Senior Member
[rich]
symbol PushButton = pinC.0
symbol LampioDIR = C.1
symbol Lamp = pinC.1
symbol PBcopy = bit0
symbol PBmem = bit1
symbol PBredge = bit2
low LampioDIR ' Set pin as output, and drive it low
do ' Detect rising edge of pushbutton
PBcopy = PushButton
PBredge = PBcopy andnot PBmem
PBmem = PBcopy
' If rising edge detected, change lamp state
if PBredge = 1 then
Lamp = not Lamp
endif
;
; Room here for more code
; which can run all the time
;
loop
[/code]
symbol PushButton = pinC.0
symbol LampioDIR = C.1
symbol Lamp = pinC.1
symbol PBcopy = bit0
symbol PBmem = bit1
symbol PBredge = bit2
low LampioDIR ' Set pin as output, and drive it low
do ' Detect rising edge of pushbutton
PBcopy = PushButton
PBredge = PBcopy andnot PBmem
PBmem = PBcopy
' If rising edge detected, change lamp state
if PBredge = 1 then
Lamp = not Lamp
endif
;
; Room here for more code
; which can run all the time
;
loop
[/code]