Arduino Yun (with built-in Ethernet) is connected to a PC (through Ethernet) which is connected (through WiFi) to my router. Is set to receive UDP packets from another PC (on the same network). That PC uses netcat to send those packets.
Arduino Yun prints the received packets, but it also prints some gibberish.
I'm pretty sure it has something to do with the remaining data on the buffer from previous transmissions. This is what I send:
Then I write "a" and press enter (also from netcat), and Arduino gets this:
And this is my code:
char udp_buffer[UDP_TX_PACKET_MAX_SIZE];
void setup() {
Bridge.begin();
Udp.begin(9911);
Serial.begin(9600);
if (!rf95.init())
Serial.println("init failed");
rf95.setTxPower(20, false);
IPAddress IP(192, 168, 1, 10);
}
void loop() {
int udp_received = Udp.parsePacket();
if (udp_received) {
Udp.read(udp_buffer, UDP_TX_PACKET_MAX_SIZE);
Serial.println(udp_buffer);
}
}