Sub Process_Globals
Public Serial1 As Serial
Private Server As WiFiServerSocket
Private Astream As AsyncStreams
Private APSSID As String = "esp"
Public WiFi As ESP8266WiFi
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
Select WiFi.StartAccessPoint(APSSID)
Case 1
Log("Access Point Initialisation Successful")
Log("SSID: ",APSSID)
Log("ip: ", WiFi.AccessPointIp)
Server.Initialize(80,"Server_NewConnection")
Server.Listen
Case 0
Log("Something Went wrong!")
WiFi.Disconnect
End Select
End Sub
Sub Server_NewConnection(NewSocket As WiFiSocket)
Log("new connection")
Astream.Initialize(NewSocket.Stream,"Astream_NewData", "Astream_Error")
Astream.Write("ok".GetBytes())
End Sub
Sub astream_NewData (Buffer() As Byte)
Log("stream")
End Sub
Sub Astream_Error
Log("Error.")
End Sub