B4R Question WiFi Serial Transmission Module

Mostez

Well-Known Member
Licensed User
I tested it and it works very well, the good thing also about it, is the built it web configuration pages, no AT commands needed, but unfortunately there is no any I/O pins to use.
 
Upvote 0

embedded

Active Member
Licensed User
@Mostez Sorry for delay....here is my UDP Serial bridge code..
B4X:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 300
#End Region

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 usocket As WiFiUDP
    Private wifi As ESP8266WiFi
    Private ip() As Byte = Array As Byte(192, 168, 4, 2)
    Private port As UInt = 5000
    Private AStream As AsyncStreams
    Public msg As String
    Public data1(4) As Byte
End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    Select wifi.StartAccessPoint2("MyESP","live1234")
        Case 1
            Log("Access Point Initialisation Successful")
            Log("SSID: ","MyESP")
            Log("ip: ", wifi.AccessPointIp)
            usocket.Initialize(5000, "usocket_PacketArrived")
            AStream.Initialize(Serial1.Stream, "Astream_NewData", "Astream_Error")
        Case 0
            Log("Something Went wrong!")
            wifi.Disconnect
    End Select
    
End Sub

Private Sub usocket_PacketArrived (data() As Byte, ip1() As Byte, port1 As UInt)
    Log(data)
    
End Sub

'Sub send_data
    'usocket.BeginPacket(ip,port)
    'usocket.Write("Msg Arrived".GetBytes)
    'usocket.SendPacket
'End Sub

Sub Astream_NewData (Buffer() As Byte)
    
    usocket.BeginPacket(ip,port)
    usocket.Write(Buffer)
    usocket.SendPacket
End Sub

Sub AStream_Error
    Log("error")
End Sub
 
Upvote 0
Top