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
Public softser As SoftwareSerial
Public bc As ByteConverter
Public wifi As ESP8266WiFi
Private timer1 As Timer
Public Astream As AsyncStreams
Private ser As B4RSerializator
Public humidity(),temperature() As Byte
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
softser.Initialize(115200,5,4) '5 as for RX(D1) and 4 is for TX(D2)
Astream.InitializePrefix(softser.Stream,False,"Arduino_Received_Data",Null)
Astream.MaxBufferSize=500
Astream.WaitForMoreDataDelay=300
timer1.Initialize("timer1_Tick",2000)
timer1.Enabled=True
Log("AppStart")
'Connect the Router
wifi.Connect2("MADHU","xxxx")
Log("Wifi Connected Successfully!!!")
End Sub
Private Sub timer1_Tick
' checkConStatus
'RunNative("read",Null)
End Sub
Private Sub Arduino_Received_Data(buffer() As Byte)
Private BE(200) As Object
ser.ConvertBytesToArray(buffer,BE)
GlobalStore.Put(0,BE(0)) 'humid.
GlobalStore.Put(1,BE(1)) 'Temperature
Log("Humid :",GlobalStore.Slot0)
End Sub