Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By gerardwr
#14273 Now that the bug in the UDP library is fixed (ref http://www.esp8266.com/viewtopic.php?f=29&t=2390) here's a basic working sketch for bidirectional UDP communication. The ESP displays the content of the received packet in the Serial Monitor and sends a confirmation message back to the UDP sender.

Below you will find:
- screen dump, upper part = Serial Monitor ESP, lower part is from Mac OS using netcat/nc as counterpart for the ESP.
- the example sketch

Schermafbeelding 2015-04-12 om 13.46.45.png


UdpClientServer.ino.zip
You do not have the required permissions to view the files attached to this post.
User avatar
By Sunspot
#15936 Many thanks for this
I have a Mac as you do
but
from the Mac I get "Your UDP packet was received OK" with no delay
but on the serial monitor there is a delay of 2 to 10 seconds to show the string I typed on the Mac

The ESP8266 is 2 m from my wifi router.
Can you say how to speed things up?
User avatar
By Sunspot
#15982 Reference my delay above.
After leaving the Mac ESP on all night I now find almost no delay receiving in the Arduino WinXP VMware terminal
Odd?
User avatar
By notrub
#17261 I've been trying to play with UDP on my ESP8266, and keep getting stuck: the reply only happens once. I have tried a few different examples people have posted, including this one, and the problem is always the same. After a reset on the chip, it will again receive 1 message and send 1 reply, but stop there. Any help that can be offered would be appreciated. Thanks in advanced.

EDIT:
I got it working! After more searching, the problem was in the IDE. I found the solution in this post:
http://www.esp8266.com/viewtopic.php?f=29&t=2222#p16377
I updated my Arduino IDE to 1.6.4, then added the ESP hardware folder again, and all is working.