esp8266-arduino | arduino library for doing basic HTTP commands
kandi X-RAY | esp8266-arduino Summary
kandi X-RAY | esp8266-arduino Summary
An arduino library for doing basic HTTP commands with the ESP8266 chip
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of esp8266-arduino
esp8266-arduino Key Features
esp8266-arduino Examples and Code Snippets
Community Discussions
Trending Discussions on esp8266-arduino
QUESTION
The problem testing my mood for the past few days is that although my ESP8266 chip is perfectly capable of fetching packets with parsePacket in a while loop, it completely misses these when I want BOTH to listen to incoming packets, but also allow my ESP8266 to read out sensors and send these over wifi.
So I cut out everything that has to do with the sensors and pasted the code below, but here is what's happening.
- In Setup(), the ESP sets up the wifi, SoftAP node, UDP and configures it.
- It then gets to a while loop where it listens for an incoming package over wifi; this tells the ESP to start spitting out data.
- When the ESP receives a packet (this is the "A. <<<" comment in my code and works fine), the code moves to the Loop() part and the sensors start spitting out data which is send over wifi
MY PROBLEM IS THIS STEP:
- During reading out the sensors and sending data over wifi I want the ESP8266 also to be able to receive incoming packets over wifi (this is the "B. <<<" comment in my code and does not work), the ESP keeps sending sensor data over wifi, but it does not receive any packets
My guess is that A. works fine because the 'while' condition will allow parsePacket to always catch an incoming packet. And because B. is inside the void loop I cannot use a 'while' condition but instead an 'if' statement, the parsePacket command is not requesting for an incoming package on the right moment. I have not been able to implement something that solves this. Quite a bit of searching is not really helping out and I cannot imagine I am alone having this problem.
Some things I found related:
- The WifiEventHandler unfortunately does not list an event that is related to receiving a packet: https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/generic-class.html
- I also found this topic, but I am unable to get this to work and the answer to this question somehow does not seem complete: Making a UDP class which doesn't block an ESP8266 / Arduino
I greatly appreciate your help and feedback!
Here is my code:
...ANSWER
Answered 2020-Jan-29 at 04:41The WiFi events in "Generic Class" are for OSI levels below transport layer. TCP and UDP are transport layer.
To receive UDP packets you must call UDP.parsePacket();
in loop()
(or in a function called from loop()
) like with every other Arduino networking library implementing the Arduino UDP
base class.
If packet is available call to parsePacket
reads the packet into internal buffer and returns the size of the packet. Next call to parsePacket
clears the buffer and fills it with new packet if it is available. You call parsePacket
twice and the second always returns nothing.
QUESTION
I have a very simple proto:
...ANSWER
Answered 2019-Jun-19 at 09:50For optional fields, you also have to set the has_field
:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install esp8266-arduino
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page