Ho bisogno di mandare pacchetti UDP verso il PC.
Ho preso l' esempio UDPSendReceiveString e l' ho ripulito...
Non funziona, non invia nulla.
Se pero' rimetto la linea "Udp.parsePacket();" ed invio qualsiasi cosa dal PC all'Arduino, questo si mette a trasmettere !
Perche' ?
Arduino UNO R3 + EthernetShield R3 (Wiznet5100)
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xE0};
IPAddress ip(192, 168, 90, 170);
IPAddress remote(192, 168, 90, 140);
int counter = 0;
EthernetUDP Udp;
void setup(){
Ethernet.begin(mac,ip);
Udp.begin(9000);
}
void loop() {
Udp.parsePacket();
Udp.beginPacket(Udp.remoteIP(), 9000);
Udp.write(counter);
Udp.endPacket();
delay(1000);
counter ++;
}