Esp32 enable LED on second Esp32

Hello!

I wanted to play a little bit with the ESP32 wifi stuff, but most examples are for esp8266. Has someone an example of Esp32 remote enable LED?

You can look into ESPNOW peer-to-peer ("one-way communication").

I've worked the example but I'm not getting this part

typedef struct struct_message {
  char a[32];
  int b;
  float c;
  String d;
  bool e;
} struct_message;

At least, I'm trying to figure out how to winnow that
(on the sender and receiver sketches) down to
something simple
i.e. just a bool.

I'm trying to figure out how to winnow that
(on the sender and receiver sketches) down to
something simple

Looking at the code, this line
esp_err_t result = esp_now_send(broadcastAddress, (uint8_t *) &myData, sizeof(myData));sends the data. If myData was a boolean rather than a struct at both ends of the link then it should just work

I’m looking to switch 8 LEDS on one slave buy making 8 switches on the Master using GPIOs 16,17,18,19,21,22,23,25.
Problem is when I make any switch on the master all LEDS on the slave come on together.

I can get everything to work fine with one GPIO (16) as per this code

#include <esp_now.h>
#include <WiFi.h>

#define GPIO 16
#define CHANNEL 1
#define SENDCHANNEL 1
#define WIFI_DEFAULT_CHANNEL 3

uint8_t gpioStatus = 0;
esp_now_peer_info_t peer;

void initESPNow();
void configDeviceAP();
void addPeer(uint8_t *peerMacAddress);
void onDataSent(const uint8_t *mac_addr, esp_now_send_status_t status);
void onDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len);

void setup()
{
Serial.begin(115200);

//Set device in AP mode to begin with
WiFi.mode(WIFI_AP);

// configure device AP mode
configDeviceAP();

// This is the mac address of the Slave in AP Mode
Serial.print("AP MAC: ");
Serial.println(WiFi.softAPmacAddress());

// Init ESPNow with a fallback logic
initESPNow();

// Once ESPNow is successfully Init, we will register for recv CB to
// get recv packer info.
esp_now_register_send_cb(onDataSent);
esp_now_register_recv_cb(onDataRecv);

pinMode(GPIO, OUTPUT);
}

void loop()
{
digitalWrite(GPIO, gpioStatus);
delay(10);
}

BUT IF I MODIFY IT LIKE THIS to add a second switch they wont switch independently

#include <esp_now.h>
#include <WiFi.h>

#define GPIO1 16
#define GPIO2 17
#define CHANNEL 1
#define SENDCHANNEL 1
#define WIFI_DEFAULT_CHANNEL 3

uint8_t gpioStatus = 0;
esp_now_peer_info_t peer;

void initESPNow();
void configDeviceAP();
void addPeer(uint8_t *peerMacAddress);
void onDataSent(const uint8_t *mac_addr, esp_now_send_status_t status);
void onDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len);

void setup()
{
Serial.begin(115200);

//Set device in AP mode to begin with
WiFi.mode(WIFI_AP);

// configure device AP mode
configDeviceAP();

// This is the mac address of the Slave in AP Mode
Serial.print("AP MAC: ");
Serial.println(WiFi.softAPmacAddress());

// Init ESPNow with a fallback logic
initESPNow();

// Once ESPNow is successfully Init, we will register for recv CB to
// get recv packer info.
esp_now_register_send_cb(onDataSent);
esp_now_register_recv_cb(onDataRecv);

pinMode(GPIO1, OUTPUT);
pinMode(GPIO2, OUTPUT);
}

void loop()
{
digitalWrite(GPIO1, gpioStatus);
delay(10);
digitalWrite(GPIO2, gpioStatus);
delay(10);
}
Any idea if there are tutorials available to help Please?

Welcome to the Forum. Please read these two posts:

General Guidance and How to use the Forum
and
Read this before posting a programming question …

You have posted code without using code tags. The code tags make the code look

like this

when posting source code files. It makes it easier to read, and can be copied with a single mouse click. Also, if you don’t do it, some of the character sequences in the code can be misinterpred by the forum code as italics or funny emoticons. The “Code: [Select]” feature allows someone to select the entire sketch so it can be easily copied and pasted into the IDE for testing or review.

If you have already posted without using code tags, open your message and select “modify” from the pull down menu labelled, “More”, at the lower right corner of the message. Highlight your code by selecting it (it turns blue), and then click on the “</>” icon at the upper left hand corner. Click on the “Save” button. Code tags can also be inserted manually in the forum text using the code and /code metatags.