Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public Serial1 As Serial
Private Blinker As Timer
Private StatusLEDpin As Pin
Private wifi As ESP8266WiFi
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
StatusLEDpin.Initialize(4,StatusLEDpin.MODE_OUTPUT)
Blinker.Initialize("Timer1_Tick", 700)
End Sub
Sub WIFIConnect(unused As Byte)
If wifi.Connect2("SSID","PSSWD") Then
Log("Verbunden.")
Log("ip: ", wifi.LocalIp)
Else
Log("Failed to connect. Try Again...")
Blinker.Enabled = True
WIFIConnect(0)
Return
End If
End Sub
Private Sub Timer1_Tick
Dim currentState As Boolean = StatusLEDpin.DigitalRead
Dim NewState As Boolean = Not(currentState)
StatusLEDpin.DigitalWrite(NewState)
End Sub