rbghongade Well-Known Member Licensed User Longtime User Aug 3, 2016 #1 Dear Erel and friends, I received my Wemos D1 R2 yesterday. Tried example in " getting started" worked great. Now I want to setup a server on Wemos board and acquire analog input from A0 pin, then send it to a client on Android (B4A). Tried using topic info at https://www.b4x.com/android/forum/threads/esp8266-connect-as-server-to-b4a-solved.69547/ but am getting nowhere. It would be great if you guys create a step by step tutorial for the same. regards,
Dear Erel and friends, I received my Wemos D1 R2 yesterday. Tried example in " getting started" worked great. Now I want to setup a server on Wemos board and acquire analog input from A0 pin, then send it to a client on Android (B4A). Tried using topic info at https://www.b4x.com/android/forum/threads/esp8266-connect-as-server-to-b4a-solved.69547/ but am getting nowhere. It would be great if you guys create a step by step tutorial for the same. regards,
Erel B4X founder Staff member Licensed User Longtime User Aug 3, 2016 #2 A complete example is attached. Attachments B4R_Server.zip B4R_Server.zip 981 bytes · Views: 1,268 B4A_Client.zip B4A_Client.zip 8.2 KB · Views: 1,205 Upvote 0
rbghongade Well-Known Member Licensed User Longtime User Aug 5, 2016 #3 Dear Erel, Thanks for the solution. Can I do the same with B4J instead of B4A? Please point me to the correct library for B4J. warm regards, Upvote 0
Dear Erel, Thanks for the solution. Can I do the same with B4J instead of B4A? Please point me to the correct library for B4J. warm regards,
Erel B4X founder Staff member Licensed User Longtime User Aug 5, 2016 #4 Yes. Should be simple. Same libraries as in B4A (jRandomAccessFile and jNetwork). Upvote 0
rbghongade Well-Known Member Licensed User Longtime User Aug 5, 2016 #5 Dear Erel, I could do it quickly! Thanks. Works great, but I did not use watchdog timer. Can you please elaborate as to why it is used? I an a total newbie with ip related concept! thanks once again. Upvote 0
Dear Erel, I could do it quickly! Thanks. Works great, but I did not use watchdog timer. Can you please elaborate as to why it is used? I an a total newbie with ip related concept! thanks once again.
Erel B4X founder Staff member Licensed User Longtime User Aug 7, 2016 #6 When I tested it I saw that the Android device didn't recognize that the connection has broken when I reset the ESP. The watchdog resets the connection if no data has arrived in 10 seconds. Upvote 0
When I tested it I saw that the Android device didn't recognize that the connection has broken when I reset the ESP. The watchdog resets the connection if no data has arrived in 10 seconds.
B Bert Oudshoorn Member Licensed User Aug 7, 2016 #7 Erel answered with a TCP example(?) Here a very simple UDP one, derived from b4x information. Erel deserves a Nobel price, Anywhere Software transformed in Universal Software u4x.co... Sub Process_Globals Private wifi As ESP8266WiFi Private udp As WiFiUDP End Sub Private Sub AppStart wifi.Connect2("Hawaii","where???”) udp.Initialize(6000, "Udp_PacketArrived") End Sub Sub Udp_PacketArrived (Data() AsByte, Ip() AsByte, Port AsUInt) udp.BeginPacket(Ip,Port) udp.Write(Data) '//echo, or more writes and/or udp.Write("abcd".GetBytes) udp.SendPacket End Sub Upvote 0
Erel answered with a TCP example(?) Here a very simple UDP one, derived from b4x information. Erel deserves a Nobel price, Anywhere Software transformed in Universal Software u4x.co... Sub Process_Globals Private wifi As ESP8266WiFi Private udp As WiFiUDP End Sub Private Sub AppStart wifi.Connect2("Hawaii","where???”) udp.Initialize(6000, "Udp_PacketArrived") End Sub Sub Udp_PacketArrived (Data() AsByte, Ip() AsByte, Port AsUInt) udp.BeginPacket(Ip,Port) udp.Write(Data) '//echo, or more writes and/or udp.Write("abcd".GetBytes) udp.SendPacket End Sub