Sub Process_Globals
Private controller As GpioController
Private pin2 As GpioPinDigitalInput
Private pin1 As GpioPinDigitalOutput
Private Timer1 As Timer
Private ms As Long
End Sub
Sub AppStart (Args() As String)
controller.Initialize
pin1.Initialize(1, True) 'GpioPinDigitalOutput
pin2.Initialize("Pin2", 2) 'GpioPinDigitalInput
pin2.SetPinPullResistance("PULL_DOWN")
ms =1000
Log("Monitoring Pin2 state")
Timer1.Initialize("Timer1", ms)
Timer1.Enabled = True
StartMessageLoop
End Sub
Sub Timer1_Tick
pin1.State = Not(pin1.State)
Log("Switching Pin1 state. Pin1 state = " & pin1.State & "Interval :" & ms )
End Sub
Sub Pin2_StateChange(State As Boolean)
If State = False Then
If ms <9000 Then
Log("Pin2 StateChange event: " & State)
ms =ms+ 1000
Else
ms =1000
End If
Timer1.Initialize("Timer1",ms)
End If
End Sub