I’m using Packet Sender on Windows 7. My UDP port is 12000. The IP address of my Photon is 192.168.1.69. I send a packet using Packet Sender in UDP mode and I never get the packet. If I did I would print it was received. I can ping from a command line ‘ping 192.168.1.69’ and it gets replies. Here is my code:
// UDP Port used for two way communication
#define MAX_UDP_READ 40
unsigned int localPort = 12000;
int udp_count = 0;
int udp_bytes_read = 0;
unsigned char udp_buffer[MAX_UDP_READ] = {0};
// An UDP instance to let us send and receive packets over UDP
UDP Udp;
void setup() {
// start the UDP
Udp.begin(localPort);
Serial.begin(115200);
}
void loop() {
Serial.printlnf("Photon named Ralph IP address is..");
Serial.println(WiFi.localIP());
if (Udp.parsePacket() > 0)
{
udp_count = Udp.available();
udp_bytes_read = Udp.read(udp_buffer, MAX_UDP_READ);
Serial.println("UDP bytes read");
}
// We'll leave it on for 1 second...
delay(1000);
}
Packet Sender shows:
From IP = You
From Port = 55056
To IP = 192.168.1.69
To Port = 12000
Method = UDP
Error = blank
ASCII = Hello Phonton
Hex = 48 65 6c 6c 6f 20 50 68 6f 74 6f 6e