'Non-UI application (console application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: true
#End Region
Sub Process_Globals
Dim controller As GpioController
Dim PinXi As GpioPinDigitalInput
Dim Reading As Int
Dim Timer1 As Timer
End Sub
Sub AppStart (Args() As String)
Reading = 0
controller.Initialize
PinXi.Initialize("PinXi", 27) ' Init the Input Pin
Private PinXo As GpioPinDigitalOutput = PinXi.ChangeToOutput
PinXo.Initialize(27, False) ' Set the Pin for Output and LOW in order to reset the capacitor
PinXi = PinXo.ChangeToInput ' Set the Pin for Input in order to read when its' State changes to HIGH
Timer1.Initialize("Timer1",10) ' Check the value every 10 milliseconds
StartMessageLoop
End Sub
Sub PinXi_StateChange(State As Boolean)
If State = True Then
Timer1.Enabled = False
Log("Reading: " & Reading)
Reading = 0
Private PinXo As GpioPinDigitalOutput = PinXi.ChangeToOutput
PinXo.Initialize(27, False) ' Set the Pin for Output and LOW in order to reset the capacitor
PinXi = PinXo.ChangeToInput ' Set the Pin for Input in order to read when its' State changes to HIGH
Timer1.Enabled = True
End If
Log("PinXi StateChange event: " & State)
End Sub
Sub Timer1_Tick
Reading = Reading + 1
End Sub