Sub Process_Globals
Public Serial1 As Serial
Private wifi As ESP8266WiFi
Private udp As WiFiUDP
Private timer1 As Timer
Private ip() As Byte = Array As Byte(192, 168, 0, 104)
Private port As UInt = 51042
Private serializator As B4RSerializator
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
If wifi.Connect2("TP-LINK_D577", "xxx") = False Then
Log("Failed to connect")
Return
End If
Log("connected")
If udp.Initialize(54329, "udp_PacketArrived") = False Then
Log("Failed to create UDP socket")
Return
End If
timer1.Initialize("timer1_Tick", 1000)
timer1.Enabled = True
End Sub
Sub MyLog(Message() As Object)
udp.BeginPacket(ip, port)
udp.Write(serializator.ConvertArrayToBytes(Message))
udp.SendPacket
End Sub
Sub Timer1_Tick
MyLog(Array("Time here is: ", Millis))
End Sub
Sub udp_PacketArrived (Data() As Byte, ip1() As Byte, port1 As UInt)
End Sub