I followed this great tutorial to setup the ESPNow protocol. It ran smoothly.

ESPNow Tutorial

ESPNow Tutorial

ESP-NOW Sender Code Explanation

Purpose:

Send a small data packet to another ESP32 using ESP-NOW.

Key Steps:

  1. Include Libraries

Includes esp_now.h and WiFi.h so the ESP32 can use ESP-NOW and Wi-Fi features.

  1. Create a Data Structure

Defines a struct to organize the data being sent (e.g., an integer and a float).

  1. Define Receiver MAC Address

You manually set the MAC address of the device you want to send data to.

  1. Initialize ESP-NOW in setup()

• Sets ESP32 to Wi-Fi Station mode.

• Starts ESP-NOW.

• Registers the receiver as a peer using its MAC address.

• Sets a callback to check if the message was successfully sent.

  1. Send Data in loop()