Page 1 of 1
sending ESP8266 AP UDP data to Windows 7 for display purpose
Posted:
Fri Oct 14, 2016 5:09 pm
by dominator99
Following on from my post in July, I've managed to get 4 ESP8266 Adafruit Huzzah 'clients' (STA) to communicate with an Adafruit Huzzah Feather AP sending temperature data from 4 different locations using UDP very reliably.
Is it possible to send this data to a Windows 7 PC wirelessly for display purposes? If so, how would I start?
I'm a newbie to this so please explain any suggestions in detail
Re: sending ESP8266 AP UDP data to Windows 7 for display pur
Posted:
Sat Oct 15, 2016 8:56 am
by picstart
Well,this is not a definitive statement ( I have a WIN10 pro) and I believe Microsoft strongly discourages the use of UDP...I tried using Lazarus but I never could get it to work.
I spent a few hours on it and gave up.
Re: sending ESP8266 AP UDP data to Windows 7 for display pur
Posted:
Sat Oct 15, 2016 9:03 am
by sergio2015
Hi.
I could not et if you intend to use win7 PC to act as an AP or just to place an UDP listener based App on Win7 to collect client data.
In both cases be aware of Wndows firewall that it normally blocks UDP datagrams.
Re: sending ESP8266 AP UDP data to Windows 7 for display pur
Posted:
Sun Oct 16, 2016 5:29 pm
by mrburnette
I've used Processing to listen to UDP ... it is cross-platform. The sketch is below:
Code: Select all// Processing UDP example to send and receive binary data
// https://thearduinoandme.wordpress.com/t utorials/esp8266-send-receive-binary-data/
// Badly hacked by Ray B. to display the UDP broadcast from ESP8266
import hypermedia.net.*; // http://ubaa.net/shared/processing/udp/udp_class_udp.htm
String ip = "10.10.10.1"; // the remote IP address of ESP8266
int port = 8888; // the destination port - any unused port
long previousMillis = 0;
long interval = 500;
UDP udp;
void setup() {
udp = new UDP(this, 8888);
udp.listen( true );
}
void draw() {
if (previousMillis < millis() - interval) {
previousMillis = previousMillis + interval;
byte[] message = new byte[2];
message[0] = 0; message[1] = 0;
udp.send(message, ip, port);
}
}
void keyPressed() {
if (key == '-')
{
byte[] message = new byte[2];
message[0] = 0; message[1] = 0;
udp.send(message, ip, port);
}
}
void keyReleased() {
if (key != '-') {
byte[] message = new byte[2];
message[0] = 0; message[1] = 0;
udp.send(message, ip, port);
}
}
void receive( byte[] data ) { // <– default handler
for (int i=0; i < data.length; i++)//void receive( byte[] data, String ip, int port ) { // <– extended handler
print(char(data[i]));
println();
}
Ray