Android Question UDP _seekbar


New Member
I want to control two LEDs by connecting UDP to two seekbars. But I do not know what command to use to send values so that each LEd is controlled separately.
The code I wrote sends values with the udp protocol, but because the values sent are the same name, both LEDs are controlled by changing a seekbar. How can I send a name along with the sent bytes so that the recipient of the message notices the seekbar change.
My code is as follows:

#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    Dim server As UDPSocket
End Sub

Sub Globals
    Private IP As EditText
    Dim s1 As ServerSocket
    Private SeekBar1 As SeekBar
    Private Label2 As Label
    Private SeekBar2 As SeekBar
End Sub

Sub Activity_Create(FirstTime As Boolean)
End Sub

Sub server_PacketArrived (Packet As UDPPacket)
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub SeekBar1_ValueChanged (Value As Int, UserChanged As Boolean)
    Dim b1 As ByteConverter
    Dim b2 As String
    b2 = SeekBar1.Value
    Dim p4 As UDPPacket
End Sub

Sub SeekBar2_ValueChanged (Value As Int, UserChanged As Boolean)
    Dim b1 As ByteConverter
    Dim b2 As String
    b2 = SeekBar1.Value
    Dim p5 As UDPPacket
End Sub


New Member
I am using the nodemcu module.
That is, the values sent from each seekbar are read by the Arduino.
I do not know what command to use in b4a to be able to separate the values sent by seekbar1, seekbar 2


New Member
Arduino code receives the packet and converts it to a string. In Arduino we can add an extension called the received packet to read only the data sent with the same name.
But I do not know how to separate these codes in b4a.
Let me ask my questions with an example:
I want to write a program that sends information to another Android device (with UDP protocol) via 2 seekbar. Can you give me these codes ???
I really need this code. Thank you if you can help me.
I can not type well in English and use a translator.


Well-Known Member
Licensed User
If it is a string then you can use the reg method regex. You just need to form the appropriate string in Arduino and then in B4 properly extract the data using one of the following methods