Hello,
I am trying to send a character from a photon to another photon using UPD. The sending photon uses this code:
UDP Udp;
char buffer1[] = "a";
IPAddress remoteIP(192, 168, 1, 104);
int port = 8888;
void setup() {
Udp.begin(8888);
Serial.begin(9600);
}
void loop(){
if (Udp.sendPacket(buffer1, sizeof(buffer1), remoteIP, port) < 0) {
Serial.println("Error");
}
The receiving photon runs this code:
unsigned int port = 8888;
UDP Udp;
void setup() {
Serial.begin(9600);
Udp.begin(port);
}
void loop(){
if (Udp.parsePacket() > 0) {
Serial.println("character received");
int i = Udp.read();
Serial.println(i);
Udp.flush();
}
}
I don’t get an error but the receiving photon doens’t seem to receive anything. I am sure that I using the correct IP-address. What could be wrong? I assume UPP is supported with the particle photon (photons were bought one month ago).
Thanks in advance,
Bart