Sending HTTP requests from one ESP32 to another

Luka_R
Posts: 1
Joined: Tue Feb 23, 2021 8:09 pm

Sending HTTP requests from one ESP32 to another

Postby Luka_R » Tue Feb 23, 2021 8:23 pm

Hello,

I am currently developing an application where I have an ESP32 setting up an HTML page via the AsyncWebServer library - let's call it the "master" ESP32.

Inside that HTML, I have an <iframe> window whose src is the IP address of an ESP32-CAM module on the same network - this one is the "slave" ESP32, since I'm only using it to get the camera stream in the iframe - this ESP is using the "esp_http_server.h" library to send its stream.

What I would like to do, is be able to control the flashlight on the slave ESP (by switching GPIO4 on/off), via WiFi. How would I be able to do this, considering the fact the whole HTML interface is programmed by the master ESP?

My guess is that the master ESP would send an HTTP GET request to the slave ESP, which the slave would handle by toggling the GPIO4 pin. But even though I see this as an idea, I don't know how to turn it into code.

If the idea is ok, could anyone provide me with a snippet of code for the master ESP to send a request to a certain IP address (using the AsyncWebServer library), and for the slave ESP to handle this request (using the esp_http_server library)?

Thanks in advance!

Who is online

Users browsing this forum: No registered users and 91 guests