Android Question When I move a cursor, the “SendValueToArduinoWiFi” event should send the value (integer) so fast as possible to 'Arduino Uno Wifi rev2' via WAN

Ponslet

Member
Licensed User
Hello,

In summary, what I would like to do is quite simple…
the code speaks for itself : SendValueToArduinoWiFi

I have a form programmed in B4x with two cursors
When I move a cursor, the “SendValueToArduinoWiFi” event should send the value (integer) so fast as possible to 'Arduino Uno Wifi rev2' via WAN (Wide Area Network)

(In b4x, it would seem that Socket.IO is appropriate for doing this ?)

Thanks you very much.
Jean

B4X:
...
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    
    Label1.Text=49
    Label2.Text=51
End Sub

Sub SendValueToArduinoWiFi(MyValue As Int)
    ' Send MyValue so fast as possible to 'Arduino Uno Wifi rev2' via WAN (Wide Area Network) 3G/4G/5G (not via loca Wifi !)    '
    ' (not with B4R) because because the rest of the program is already written in classic Arduino language
End Sub

Private Sub SeekBar1_ValueChanged (Value As Int, UserChanged As Boolean)
    Label1.Text=Value
    SendValueToArduinoWiFi(Value)
End Sub

Private Sub SeekBar2_ValueChanged (Value As Int, UserChanged As Boolean)
    Label2.Text=Value
    SendValueToArduinoWiFi(Value)
End Sub

 

Ponslet

Member
Licensed User
Hello Erel,
Thanks for your sugestion.
I try your example Socket +AsyncStreams, it work very well beween 2 phones in a local Wifi Network.
But, my target is to work on the WAN not on a local Wifi.
When i stop the local Wifi on my phone and I connect with 4G, I get my dynamic IP with watsmyip.com from my phone, i put it in the example but i get not connected... :-(

why things are always complicated lol... ;-))
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…