Improvement: UDP
3 posters
Page 1 of 1
Improvement: UDP
Hi,
I'm using Roboremo to control a Lego tank using ESP8266/NodeMCU. The TCP performance of NodeMCU is very limited, I'd like to use UDP, instead of TCP.
Is it possible to contribute to the project to add UDP feature to Roboremo?
I'm using Roboremo to control a Lego tank using ESP8266/NodeMCU. The TCP performance of NodeMCU is very limited, I'd like to use UDP, instead of TCP.
Is it possible to contribute to the project to add UDP feature to Roboremo?
pgillich- Posts : 3
Join date : 2016-05-22
Re: Improvement: UDP
Hi,
I updated the app and added some features including UDP connectivity. It should appear in the Google Play in a few hours. New version should display v1.9.1 in menu -> about.
I tested the UDP connection only with Node-RED, but I hope it will work with ESP too. Please let me know.
All the best,
Victor
I updated the app and added some features including UDP connectivity. It should appear in the Google Play in a few hours. New version should display v1.9.1 in menu -> about.
I tested the UDP connection only with Node-RED, but I hope it will work with ESP too. Please let me know.
All the best,
Victor
Re: Improvement: UDP
Hi, thanks for the update it works with UDP with esp but I have a problem I can send commands to esp usig UDP but I can not obtain the reponse, I sent fom esp an answer but the log does not show anithing
Thanks
Thanks
juankgp- Posts : 3
Join date : 2016-05-26
Re: Improvement: UDP
Make sure you add "\n" at the end of the string that you are sending.
You can post your ESP code here if you want, and I will take a look.
You can post your ESP code here if you want, and I will take a look.
Re: Improvement: UDP
Thanks for your reply, the par of response of my code is
Thanks
- Code:
port.print("lA ");
port.print(ou1st);
port.println(";");
Thanks
juankgp- Posts : 3
Join date : 2016-05-26
Re: Improvement: UDP
Hi,
The problem is with println. Use print instead.
This is a common mistake, the println adds "\n" at the end, but you set cmd ending to ";" so the "\n" will go to the beginning of next cmd and RoboRemo will search for item with id "\nIA" instead of "IA".
The problem is with println. Use print instead.
This is a common mistake, the println adds "\n" at the end, but you set cmd ending to ";" so the "\n" will go to the beginning of next cmd and RoboRemo will search for item with id "\nIA" instead of "IA".
Re: Improvement: UDP
pgillich wrote:Hi,
I'm using Roboremo to control a Lego tank using ESP8266/NodeMCU. The TCP performance of NodeMCU is very limited, I'd like to use UDP, instead of TCP.
Is it possible to contribute to the project to add UDP feature to Roboremo?
Many thanks for quick development!
I'll check it on this weekend.
pgillich- Posts : 3
Join date : 2016-05-22
Re: Improvement: UDP
Thanks for your fast reply I change my code for
and I don´t have response also I put a text log with no id and in the manual said if I don´t put id it shows every commands that arrive but nothing appears
- Code:
port.print("lA ");
port.print(ou1st);
port.print(";");
and I don´t have response also I put a text log with no id and in the manual said if I don´t put id it shows every commands that arrive but nothing appears
juankgp- Posts : 3
Join date : 2016-05-26
Re: Improvement: UDP
Is port a net.socket? or net.server?
Does it work with other software, like sending from ESP and receiving in Node-RED or netcat?
Does it work with other software, like sending from ESP and receiving in Node-RED or netcat?
Re: Improvement: UDP
I still didn't get it work with NodeMCU and Lua, but here is a working code written in Arudino IDE for ESP:
- Code:
// UDP communication between ESP8266 and Android phone with RoboRemo app
// Disclaimer: Don't use RoboRemo for life support systems
// or any other situations where system failure may affect
// user or environmental safety.
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
// config:
const char *ssid = "mywifi"; // You will connect your phone to this Access Point
const char *pw = "qwerty123"; // and this is the password
IPAddress ip(192, 168, 0, 1); // From RoboRemo app, connect to this IP
IPAddress netmask(255, 255, 255, 0);
const int port = 9876; // and this port
char cmdEnding[] = ";";
WiFiUDP udp;
void setup() {
delay(1000);
Serial.begin(115200);
WiFi.softAPConfig(ip, ip, netmask); // configure ip address for softAP
WiFi.softAP(ssid, pw); // configure ssid and password for softAP
udp.begin(port); // start UDP server
Serial.println("ESP8266 UDP Server");
Serial.println((String)"SSID: " + ssid + " PASS: " + pw);
Serial.println((String)"RoboRemo app must connect to " + ip.toString() + ":" + port);
}
char buf[256]; //buffer for received packets
void loop() {
// if there’s data available, read a packet
int packetSize = udp.parsePacket();
if(packetSize>0) {
Serial.println((String)"received packet (" + packetSize + " Bytes)");
Serial.print("from ");
IPAddress ip = udp.remoteIP();
Serial.println((String)"" + ip[0] + "." + ip[1]
+ "." + ip[2] + "." + ip[3]
+ ":" + port);
udp.read(buf, 256);
// buf contains the cmd received from RoboRemo (including cmd ending)
udp.beginPacket(ip, port); // remote IP and port
udp.write("dbg "); // dbg is the id of text log
udp.write(buf, packetSize);
udp.endPacket();
}
}
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|