I spent HOURS on Google and there is Absolutely NOTHING about this subject..
I'm running an ESP32 system, and an ESP8266 system. I need to communicate with the ESP8266.
I need to send GET requests like "123.123.2.12/LEDON" to the ESP8266 from my ESP32. BUT at the same time the ESP32 need's to respond to GET requests from my phone or others.
HOW???
I found AsyncWebServer but I think this is different. I need something to send GET requests to a specific URL / IP like "123.123.2.12/LEDON" I can't find that in AsyncWebServer. I only find stupid things like "request->send(200, "text/plain", "Hello, GET: " + message);"
Deva_Rishi:
and either to espwebserver or aSyncWebserver to respond to request.
You mean I should use httpClient to SEND the requests to the ESP8266
AND in the same sketch use AsyncWebServer to read the requests coming in? Will that work together?
On the ESP8266, you need to run a web server, and receive request to light on or off your led.
On the ESP32, you need to run a web server (async or not) to receive the requests from internet AND run a client that will send the commands to the ESP8266.
Here is a tutorial fro ESP32 to learn to parse incoming requests. Another one here for ESP8266.
For the client, just look at the examples of the library.
juniq:
You mean I should use httpClient to SEND the requests to the ESP8266
AND in the same sketch use AsyncWebServer to read the requests coming in? Will that work together?
Juraj:
use HttpClient library to send a GET request.
That is not helpful man.. Read my question before you answer.
lesept:
Here is what I understand on the subject.
On the ESP8266, you need to run a web server, and receive request to light on or off your led.
On the ESP32, you need to run a web server (async or not) to receive the requests from internet AND run a client that will send the commands to the ESP8266.
Here is a tutorial fro ESP32 to learn to parse incoming requests. Another one here for ESP8266.
For the client, just look at the examples of the library.
lesept:
Here is what I understand on the subject.
On the ESP8266, you need to run a web server, and receive request to light on or off your led.
On the ESP32, you need to run a web server (async or not) to receive the requests from internet AND run a client that will send the commands to the ESP8266.
Here is a tutorial fro ESP32 to learn to parse incoming requests. Another one here for ESP8266.
For the client, just look at the examples of the library.
lesept:
Here is what I understand on the subject.
On the ESP8266, you need to run a web server, and receive request to light on or off your led.
On the ESP32, you need to run a web server (async or not) to receive the requests from internet AND run a client that will send the commands to the ESP8266.
Here is a tutorial fro ESP32 to learn to parse incoming requests. Another one here for ESP8266.
For the client, just look at the examples of the library.
You don't seem to understand the problem.. I know how to build a server and a client.
BUT they don't work together in one sketch. Either one of them (server or client) fails.
I owe u a beer man. Thanks!! it works like a charm! So basically what this AsyncWebServer does is running on the second cpu core? Or why is it running in background letting me do anything I want in the void loop?
Juraj:
yes
I owe u a beer man. Thanks!! it works like a charm! So basically what this AsyncWebServer does is running on the second cpu core? Or why is it running in background letting me do anything I want in the void loop?
So basically what this AsyncWebServer does is running on the second cpu core? Or why is it running in background letting me do anything I want in the void loop?
as far as i know it runs on any single cores esp8266 just as well. It may run on the second core i don't know, but the main difference with the ordinary espWebServer is that you don't need to call .handleClient() , it sort does that for you, i think it makes use of events, the normal webserver let's you do whatever you want as well, as long as you call .handleClient() You probably understand that that has both advantages & disadvantages (you may not always want any process to be interrupted)
Deva_Rishi:
as far as i know it runs on any single cores esp8266 just as well. It may run on the second core i don't know, but the main difference with the ordinary espWebServer is that you don't need to call .handleClient() , it sort does that for you, i think it makes use of events, the normal webserver let's you do whatever you want as well, as long as you call .handleClient() You probably understand that that has both advantages & disadvantages (you may not always want any process to be interrupted)
Hey check my latest reply on this subject. Maybe you can help me out with this? It's working but my watchdog gets triggered and I don't know why. I could disable it with the ESP-IDF Tools but downloading these tools would take like 5 hours.. (slow internet here).
If your wdt gets triggered it is because it doesn't get reset within 2.5s The best way to prevent this is to add yield();in your code where there are long (or infinite) loops.
yield(); tells the processor to executed scheduled tasks (FI task related to your wifi connection that are happening in the background) Normally at the end of loop() a yield() is executed automatically, delay() also executes a yield() (delayMicroseconds() does not ! ) I haven't checked you code, you should post it here (within </> code-tags ), not somewhere else if you want it looked at.
Deva_Rishi:
If your wdt gets triggered it is because it doesn't get reset within 2.5s The best way to prevent this is to add
yield();
in your code where there are long (or infinite) loops.
yield(); tells the processor to executed scheduled tasks (FI task related to your wifi connection that are happening in the background) Normally at the end of loop() a yield() is executed automatically, delay() also executes a yield() (delayMicroseconds() does not ! ) I haven't checked you code, you should post it here (within </> code-tags ), not somewhere else if you want it looked at.
I can't post my code here. It's too long (more than 9000 lines :D)
I still don't understand what yield actually does.. and where I should put it. Before my delay's?
I can not use delay more than 2.5 seconds in my script ?? that's stupid...
Deva_Rishi:
If your wdt gets triggered it is because it doesn't get reset within 2.5s The best way to prevent this is to add yield();in your code where there are long (or infinite) loops.
yield(); tells the processor to executed scheduled tasks (FI task related to your wifi connection that are happening in the background) Normally at the end of loop() a yield() is executed automatically, delay() also executes a yield() (delayMicroseconds() does not ! ) I haven't checked you code, you should post it here (within </> code-tags ), not somewhere else if you want it looked at.
I can't find a way.. I downloaded the ESP-IDF with my mobile network now, I had to walk like 2km to get a signal..
ONLY to realize that the installation fails and hangs up while "setting up an exclusion on Windows Defender".
I'm googling and googling. Nothing works.
yield() doesn't do a shit. I've put it EVERYWHERE in my code.
I still don't understand what yield actually does.. and where I should put it. Before my delay's?
I can not use delay more than 2.5 seconds in my script ?? that's stupid...
delay() includes yield(), so you can put delay as long as you like, you should put yield(); where you don't want delay() but do have a long long loop (or code that takes a long time) like waiting for user input. You can post your long code either as attachment or in 2 or 3 posts.