Paste for forum TEST 1

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]
 

Buzby

Senior Member
Code:
[color=Blue]symbol [/color][color=Purple]PushButton [/color][color=DarkCyan]= [/color][color=Purple]pinC.0[/color]
[color=Blue]symbol  LampioDIR [/color][color=DarkCyan]= [/color][color=Blue]C.1
symbol       [/color][color=Purple]Lamp [/color][color=DarkCyan]= [/color][color=Purple]pinC.1 [/color]

[color=Blue]symbol    [/color][color=Purple]PBcopy [/color][color=DarkCyan]= [/color][color=Purple]bit0[/color]
[color=Blue]symbol     [/color][color=Purple]PBmem [/color][color=DarkCyan]= [/color][color=Purple]bit1[/color]
[color=Blue]symbol   [/color][color=Purple]PBredge [/color][color=DarkCyan]= [/color][color=Purple]bit2[/color]

[color=Blue]low LampioDIR [/color][color=Green]' Set pin as output, and drive it low[/color]

[color=Blue]do    [/color][color=Green]' Detect rising edge of pushbutton
      [/color][color=Purple]PBcopy [/color][color=DarkCyan]= [/color][color=Purple]PushButton
      PBredge [/color][color=DarkCyan]= [/color][color=Purple]PBcopy [/color][color=DarkCyan]andnot [/color][color=Purple]PBmem
      PBmem [/color][color=DarkCyan]= [/color][color=Purple]PBcopy

      [/color][color=Green]' If rising edge detected, change lamp state
      [/color][color=Blue]if [/color][color=Purple]PBredge [/color][color=DarkCyan]= [/color][color=Navy]1 [/color][color=Blue]then
            [/color][color=Purple]Lamp [/color][color=DarkCyan]= not [/color][color=Purple]Lamp
      [/color][color=Blue]endif

      [/color][color=Green];
      ; Room here for more code 
      ; which can run all the time
      ;[/color]

[color=Blue]loop[/color]
 

Buzby

Senior Member
Rich (BB 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
 
Top