Hello,
I am using the module esp8266 to receive data on a UDP port, however I am not able to receive the data sent to this port, below the code I am using:
#include <SoftwareSerial.h>
#include <WiFiUdp.h>
SoftwareSerial internet(12, 13);
WiFiUDP udp;
void setup() {
Serial.begin(115200);
internet.begin(115200);
internet.println("AT+RST");
internet.println(("AT+CWMODE=3");
delay(500);
internet.println(("AT+CWDHCP=1,1");
delay(500);
internet.println(("AT+CWJAP=\"" + "MY_NETWORK" + "\",\"" + "MY_PASSWORD" + "\"");
delay(500);
internet.println(("AT+CIPSTART=\"UDP\",\"" + "IP_SERVER" + "\"," + "PASSWORD_SERVER");
Udp.begin(26701);
}
void loop() {
int packetSize = Udp.parsePacket();
if (packetSize > 0) {
int tam = Udp.available();
Udp.read(dados, sizeof(dados));
String protocolo;
for (int x=0; x<=tam; x++) {
protocolo += (char) dados[x];
}
}
}
Can someone help me please?