Hello,
I have this cod that using UDP for sending between 2 esp32 . The sending and receiving process doing by using Serial port.
How can I update on it to send and receive from code: I mean I need to send this message rx_val=1999;
(not from serial port) . How can I receive it ?
This code for sending:
int rp=udp.parsePacket(); //check for udp packets
rx_val=1999; //Serial.read();
Serial.print("udp_send: ");
Serial.println(rx_val);
udp.beginPacket(udpAddress,udpPort);
udp.write(rx_val);
udp.endPacket();
And this for receiving:
char pktbuf1[10];
udp.read(pktbuf1,2);
delay(20);
Serial.print("Packet from "+String(udpAddress)+": ");
Serial.print(pktbuf1);
delay(1000);