ESP-NOW with ESP8266: Send Data to Multiple Boards (one-to-many)

In this tutorial you’ll learn how to use ESP-NOW communication protocol to send data from one ESP8266 NodeMCU board to multiple ESP8266 boards (one-to-many configuration). The boards will be programmed using Arduino IDE.

ESP-NOW with ESP8266 NodeMCU: Send Data to Multiple Boards one-to-many

We have other tutorials about ESP-NOW with the ESP8266:

Project Overview

This tutorial shows how to send data from one ESP8266 to multiple ESP8266 boards using ESP-NOW (one-to-many configuration).

ESP-NOW with ESP8266 NodeMCU: Send Data to Multiple Boards (one-to-many) Project Overview
  • One ESP8266 acts as a sender;
  • Multiple ESP8266 boards act as receivers. We tested this setup with two ESP8266 boards simultaneously. You should be able to add more boards to your setup;
  • The ESP8266 sender receives an acknowledge message if the messages are successfully delivered. You know which boards received the message and which boards didn’t;
  • As an example, we’ll exchange random values between the boards. You should modify this example to send commands or sensor readings.

This tutorial covers these two scenarios:

  • sending the same message to all boards;
  • sending a different message to each board.

You may also like reading: ESP-NOW Two-Way Communication Between ESP8266 Boards.

Prerequisites

We’ll program the ESP8266 using Arduino IDE, so before proceeding with this tutorial you should have the ESP8266 add-on installed in your Arduino IDE. Follow the next guide:

Parts Required

To follow this tutorial, you need multiple ESP8266 boards.

You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!

Getting the Boards MAC Address

To send messages via ESP-NOW, you need to know the receiver boards’ MAC address. Each board has a unique MAC address (learn how to Get and Change the ESP8266 MAC Address).

Upload the following code to each of your receiver boards to get its MAC address.

/*
  Rui Santos & Sara Santos - Random Nerd Tutorials
  Complete project details at https://RandomNerdTutorials.com/get-change-esp32-esp8266-mac-address-arduino/
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.  
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/
#ifdef ESP32
  #include <WiFi.h>
  #include <esp_wifi.h>
#else
  #include <ESP8266WiFi.h>
#endif

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

  Serial.print("ESP Board MAC Address: ");
  #ifdef ESP32
    WiFi.mode(WIFI_STA);
    WiFi.STA.begin();
    uint8_t baseMac[6];
    esp_err_t ret = esp_wifi_get_mac(WIFI_IF_STA, baseMac);
    if (ret == ESP_OK) {
      Serial.printf("%02x:%02x:%02x:%02x:%02x:%02x\n",
                    baseMac[0], baseMac[1], baseMac[2],
                    baseMac[3], baseMac[4], baseMac[5]);
    } else {
      Serial.println("Failed to read MAC address");
    }
  #else
    Serial.println(WiFi.macAddress());
  #endif
}
 
void loop(){

}

View raw code

After uploading the code, press the RST/EN button, and the MAC address should be displayed on the Serial Monitor.

ESP32 ESP8266 NodeMCU board MAC Address with Arduino IDE Serial Monitor

You can write down the boards’ MAC address on a label to clearly identify each board.

ESP8266 NodeMCU Sender Code (ESP-NOW)

The following code sends data to multiple (two) ESP boards via ESP-NOW. You should modify the code with your receiver boards’ MAC address. You should also add or delete lines of code depending on the number of receiver boards.

/*
  Rui Santos
  Complete project details at https://RandomNerdTutorials.com/esp-now-one-to-many-esp8266-nodemcu/
  
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files.
  
  The above copyright notice and this permission notice shall be included in all
  copies or substantial portions of the Software.
*/

#include <ESP8266WiFi.h>
#include <espnow.h>

// REPLACE WITH RECEIVER MAC Address
uint8_t broadcastAddress1[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
uint8_t broadcastAddress2[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};

// Structure example to send data
// Must match the receiver structure
typedef struct test_struct {
    int x;
    int y;
} test_struct;

// Create a struct_message called test to store variables to be sent
test_struct test;

unsigned long lastTime = 0;  
unsigned long timerDelay = 2000;  // send readings timer

// Callback when data is sent
void OnDataSent(uint8_t *mac_addr, uint8_t sendStatus) {
  char macStr[18];
  Serial.print("Packet to:");
  snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",
         mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
  Serial.print(macStr);
  Serial.print(" send status: ");
  if (sendStatus == 0){
    Serial.println("Delivery success");
  }
  else{
    Serial.println("Delivery fail");
  }
}
 
void setup() {
  // Init Serial Monitor
  Serial.begin(115200);
 
  // Set device as a Wi-Fi Station
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();

  // Init ESP-NOW
  if (esp_now_init() != 0) {
    Serial.println("Error initializing ESP-NOW");
    return;
  }

  esp_now_set_self_role(ESP_NOW_ROLE_CONTROLLER);
  
  // Once ESPNow is successfully Init, we will register for Send CB to
  // get the status of Trasnmitted packet
  esp_now_register_send_cb(OnDataSent);
  
  // Register peer
  esp_now_add_peer(broadcastAddress1, ESP_NOW_ROLE_SLAVE, 1, NULL, 0);
  esp_now_add_peer(broadcastAddress2, ESP_NOW_ROLE_SLAVE, 1, NULL, 0);

}
 
void loop() {
  if ((millis() - lastTime) > timerDelay) {
    // Set values to send
    test.x = random(1, 50);
    test.y = random(1, 50);

    // Send message via ESP-NOW
    esp_now_send(0, (uint8_t *) &test, sizeof(test));

    lastTime = millis();
  }
}

View raw code

How the code works

First, include the espnow.h and ESP8266WiFi.h libraries.

#include <ESP8266WiFi.h>
#include <espnow.h>

Receivers’ MAC Address

Insert the receivers’ MAC address. In our example, we’re sending data to two boards.

uint8_t broadcastAddress1[] = {0x5C, 0xCF, 0x7F, 0x99, 0xA1, 0x70};
uint8_t broadcastAddress2[] = {0x5C, 0xCF, 0x7F, 0x99, 0x9A, 0xEA};

Then, create a structure that contains the data we want to send. We called this structure test_struct and it contains two integer variables. You can change this to send whatever variable types you want.

typedef struct test_struct {
  int x;
  int y;
} test_struct;

Create a new variable of type test_struct that is called test that will store the variables values.

test_struct test;

OnDataSent() callback function

Next, define the OnDataSent() function. This is a callback function that will be executed when a message is sent. In this case, this function prints if the message was successfully delivered or not and for which MAC address. So, you know which boards received the message or and which boards didn’t.

void OnDataSent(uint8_t *mac_addr, uint8_t sendStatus) {
  char macStr[18];
  Serial.print("Packet to:");
  snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",
          mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
  Serial.print(macStr);
  Serial.print(" send status: ");
  if (sendStatus == 0){
    Serial.println("Delivery success");
  }
  else{
    Serial.println("Delivery fail");
  }
}

setup()

In the setup(), initialize the serial monitor for debugging purposes:

Serial.begin(115200);

Set the device as a Wi-Fi station and disconnect Wi-Fi:

WiFi.mode(WIFI_STA);
WiFi.disconnect();

Initialize ESP-NOW:

if (esp_now_init() != 0) {
  Serial.println("Error initializing ESP-NOW");
  return;
}

Set the ESP8266 role. This is a sender board, so set its role to ESP_NOW_ROLE_CONTROLLER

esp_now_set_self_role(ESP_NOW_ROLE_CONTROLLER);

Register the callback function that will be called when a message is sent. In this case, register for the OnDataSent() function created previously.

esp_now_register_send_cb(OnDataSent);

Add peers

After that, we need to pair with other ESP-NOW devices to send data. That’s what we do in the next lines – register peers:

esp_now_add_peer(broadcastAddress1, ESP_NOW_ROLE_SLAVE, 1, NULL, 0);
esp_now_add_peer(broadcastAddress2, ESP_NOW_ROLE_SLAVE, 1, NULL, 0);

If you want to add more peers you just need to duplicate these previous lines and pass the peer MAC address:

loop()

In the loop(), we’ll send a message via ESP-NOW every 2 seconds (you can change this delay time on the timerDelay variable).

Assign a value to each variable:

test.x = random(0,20);
test.y = random(0,20);

Remember that test is a structure. Here assign the values that you want to send inside the structure. In this case, we’re just sending random values. In a practical application these should be replaced with commands or sensor readings, for example.

Send the same data to multiple boards

Finally, send the message as follows:

esp_now_send(0, (uint8_t *) &test, sizeof(test));

The first argument of the esp_now_send() function is the receiver’s MAC address. If you pass 0 as an argument, it will send the same message to all registered peers. If you want to send a different message to each peer, follow the next section.

Check if the message was successfully sent:

The loop() is executed every 2000 milliseconds (2 seconds).

if ((millis() - lastTime) > timerDelay) {
  // Set values to send
  test.x = random(1, 50);
  test.y = random(1, 50);

  // Send message via ESP-NOW
  esp_now_send(0, (uint8_t *) &test, sizeof(test));

  lastTime = millis();
}

Send different data to each board

The code to send a different message to each board is very similar with the previous one. So, we’ll just take a look at the differences.

If you want to send a different message to each board, you need to create a data structure for each of your boards, for example:

test_struct test;
test_struct test2;

In this case we’re sending the same structure type (test_struct). You can send a different structure type as long as the receiver code is prepared to receive that type of structure.

Then, assign different values to the variables of each structure. In this example, we’re just setting them to random numbers.

test.x = random(0,20);
test.y = random(0,20);
test2.x = random(0,20);
test2.y = random(0,20);

Finally, you need to call the esp_now_send() function for each receiver.

For example, send the test structure to the board whose MAC address is broadcastAddress1.

esp_now_send(broadcastAddress1, (uint8_t *) &test, sizeof(test));

Do the same for the other boards. For the second board send the test2 structure:

esp_now_send(broadcastAddress2, (uint8_t *) &test2, sizeof(test2));

Here’s the complete code that sends a different message to each board.

/*
  Rui Santos
  Complete project details at https://RandomNerdTutorials.com/esp-now-one-to-many-esp8266-nodemcu/
  
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files.
  
  The above copyright notice and this permission notice shall be included in all
  copies or substantial portions of the Software.
*/

#include <ESP8266WiFi.h>
#include <espnow.h>

// REPLACE WITH RECEIVER MAC Address
uint8_t broadcastAddress1[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
uint8_t broadcastAddress2[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};

// Structure example to send data
// Must match the receiver structure
typedef struct test_struct {
    int x;
    int y;
} test_struct;

// Create a struct_message called test to store variables to be sent
test_struct test;
test_struct test2;

unsigned long lastTime = 0;  
unsigned long timerDelay = 2000;  // send readings timer

// Callback when data is sent
void OnDataSent(uint8_t *mac_addr, uint8_t sendStatus) {
  char macStr[18];
  Serial.print("Packet to:");
  snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",
         mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
  Serial.print(macStr);
  Serial.print(" send status: ");
  if (sendStatus == 0){
    Serial.println("Delivery success");
  }
  else{
    Serial.println("Delivery fail");
  }
}
 
void setup() {
  // Init Serial Monitor
  Serial.begin(115200);
 
  // Set device as a Wi-Fi Station
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();

  // Init ESP-NOW
  if (esp_now_init() != 0) {
    Serial.println("Error initializing ESP-NOW");
    return;
  }

  esp_now_set_self_role(ESP_NOW_ROLE_CONTROLLER);
  
  // Once ESPNow is successfully Init, we will register for Send CB to
  // get the status of Trasnmitted packet
  esp_now_register_send_cb(OnDataSent);
  
  // Register peer
  esp_now_add_peer(broadcastAddress1, ESP_NOW_ROLE_SLAVE, 1, NULL, 0);
  esp_now_add_peer(broadcastAddress2, ESP_NOW_ROLE_SLAVE, 1, NULL, 0);

}
 
void loop() {
  if ((millis() - lastTime) > timerDelay) {
    // Set values to send
    test.x = random(1, 50);
    test.y = random(1, 50);
    test2.x = random(1, 50);
    test2.y = random(1, 50);

    // Send message via ESP-NOW
    esp_now_send(broadcastAddress1, (uint8_t *) &test, sizeof(test));
    esp_now_send(broadcastAddress2, (uint8_t *) &test2, sizeof(test2));
    lastTime = millis();
  }
}

View raw code

ESP8266 NodeMCU Receiver Code (ESP-NOW)

Upload the next code to the receiver boards (in our example, we’ve used two receiver boards).

/*
  Rui Santos
  Complete project details at https://RandomNerdTutorials.com/esp-now-one-to-many-esp8266-nodemcu/
  
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files.
  
  The above copyright notice and this permission notice shall be included in all
  copies or substantial portions of the Software.
*/

#include <ESP8266WiFi.h>
#include <espnow.h>

// Structure example to receive data
// Must match the sender structure
typedef struct test_struct {
    int x;
    int y;
} test_struct;

// Create a struct_message called myData
test_struct myData;

// Callback function that will be executed when data is received
void OnDataRecv(uint8_t * mac, uint8_t *incomingData, uint8_t len) {
  memcpy(&myData, incomingData, sizeof(myData));
  Serial.print("Bytes received: ");
  Serial.println(len);
  Serial.print("x: ");
  Serial.println(myData.x);
  Serial.print("y: ");
  Serial.println(myData.y);
  Serial.println();
}
 
void setup() {
  // Initialize Serial Monitor
  Serial.begin(115200);
  
  // Set device as a Wi-Fi Station
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();

  // Init ESP-NOW
  if (esp_now_init() != 0) {
    Serial.println("Error initializing ESP-NOW");
    return;
  }
  
  // Once ESPNow is successfully Init, we will register for recv CB to
  // get recv packer info
  esp_now_set_self_role(ESP_NOW_ROLE_SLAVE);
  esp_now_register_recv_cb(OnDataRecv);
}

void loop() {
  
}

View raw code

How the code works

Similarly to the sender, start by including the libraries:

#include <ESP8266WiFi.h>
#include <espnow.h>

Create a structure to receive the data. This structure should be the same defined in the sender sketch.

typedef struct test_struct {
    int x;
    int y;
} test_struct;

Create a test_struct variable called myData.

test_struct myData;

Create a callback function that is called when the ESP8266 receives the data via ESP-NOW. The function is called onDataRecv() and should accept several parameters as follows:

void OnDataRecv(uint8_t * mac, uint8_t *incomingData, uint8_t len) {

Copy the content of the incomingData data variable into the myData variable.

memcpy(&myData, incomingData, sizeof(myData));

Now, the myData structure contains several variables inside with the values sent by the sender ESP8266. To access variable x, for example, call myData.x.

In this example, we print the received data, but in a practical application you can print the data on a OLED display, for example.

Serial.print("Bytes received: ");
Serial.println(len);
Serial.print("x: ");
Serial.println(myData.x);
Serial.print("y: ");
Serial.println(myData.y);
Serial.println();

In the setup(), intialize the Serial Monitor.

Serial.begin(115200);

Set the device as a Wi-Fi Station and disconnect Wi-Fi.

WiFi.mode(WIFI_STA);
WiFi.disconnect();

Initialize ESP-NOW:

if (esp_now_init() != 0) {
  Serial.println("Error initializing ESP-NOW");
  return;
}

Set the ESP8266 role. This is a receiver board, so set its role to ESP_NOW_ROLE_SLAVE.

esp_now_set_self_role(ESP_NOW_ROLE_SLAVE);

Register for a callback function that will be called when data is received. In this case, we register for the OnDataRecv() function that was created previously.

esp_now_register_recv_cb(OnDataRecv);

Demonstration

Having all your boards powered on, open the Arduino IDE Serial Monitor for the COM port the sender is connected to.

You should start receiving “Delivery Success” messages with the corresponding receiver’s MAC address in the Serial Monitor.

ESP8266 NodeMCU ESP-NOW Send Data To Multiple Boards Delivery Status Serial Monitor

If you remove power from one of the boards, you’ll receive a “Delivery Fail” message for that specific board. So, you can quickly identify which board didn’t receive the message.

ESP8266 NodeMCU ESP-NOW Send Data To Multiple Boards Delivery Status Failed Serial Monitor

If you want to check if the boards are actually receiving the messages, you can open the Serial Monitor for the COM port they are connected to, or you can use PuTTY to establish a serial communication with your boards.

If you’re using PuTTY, select Serial communication, write the COM port number and the baud rate (115200) as shown below and click Open.

Serial Communication ESP8266  NodeMCU Boards PuTTY

Then, you should see the messages being received.

Open a serial communication for each of your boards and check that they are receiving the messages.

ESP8266 NodeMCU ESP-NOW Send Data To Multiple Boards Delivery Success Demonstration

Wrapping Up

In this tutorial you’ve learned how to send data to multiple ESP8266 boards from a single ESP8266 using ESP-NOW (one-to-many communication). You can do something similar with ESP32 boards (ESP32 ESP-NOW: One-to-many).

We hope you’ve found this tutorial useful. We have other ESP-NOW tutorials that you may like:

Learn more about the ESP8266 with our resources:

Thanks for reading.



Learn how to build a home automation system and we’ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB database DOWNLOAD »
Learn how to build a home automation system and we’ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB database DOWNLOAD »

Recommended Resources

Build a Home Automation System from Scratch » With Raspberry Pi, ESP8266, Arduino, and Node-RED.

Home Automation using ESP8266 eBook and video course » Build IoT and home automation projects.

Arduino Step-by-Step Projects » Build 25 Arduino projects with our course, even with no prior experience!

What to Read Next…


Enjoyed this project? Stay updated by subscribing our newsletter!

22 thoughts on “ESP-NOW with ESP8266: Send Data to Multiple Boards (one-to-many)”

  1. using delay() is a very bad habit.
    It leads newbees to use delay() in a way that creates non-functioning code!

    As soon as RECEIVING ESP-NOW-messages comes along delay() must be avoided like the plaque.

    Recently I found a variation of “blink without delay ” that is written almost as short as the command “delay()”

    simply add the following function at the top of your code

    //nbt nonblockingtimer
    boolean TimePeriodIsOver (unsigned long &expireTime, unsigned long TimePeriod) {
    unsigned long currentMillis = millis();
    if ( currentMillis – expireTime >= TimePeriod )
    {
    expireTime = currentMillis; // set new expireTime
    return true; // more time than TimePeriod) has elapsed since last time if-condition was true
    }
    else return false; // not expired
    }

    define as many timervariables as you like of type unsigned long

    unsigned long MyTimer = 0;

    then inside loop code

    if ( TimePeriodIsOver(MyTimer,2000) ) {
    do all the things that should only execute after 2000 milliseconds;
    }

    Next bad thing is to do all the serial.print-stuff inside the onreceive-function
    this will lead newbees to the bad habit to code even more than a few serial.prints
    inside the callback-function

    a professional way of programming is to just copy the received data into a structured variable and setup a flag “ESP-NOW-Data-received” and do all the rest inside the main-code

    best regards Stefan

    Reply
    • Exactly! We’ve updated the guide to use a timer instead of the delay, thanks as always for your helpful feedback!
      (We agree with the flag to print the data outside the function, but for demonstration purposes will leave it in this example)

      Reply
  2. Hi Rui,
    Thanks for your great article as usual.
    I would like to ask ,what is the best way to connect to an esp8266 via computer and then utilise esp-now, one 8266 as a master to many configuration.
    Is it easy to have a tcp connection or serial, can you give me some clues on how to do that please.

    Reply
  3. Hi,
    I have an ESP8266 temperature sensor module used for sending temperature readings to Blynk. Can I also use ESP-NOW to send the readings to a remote esp8266 board with an LED display? In other words, can I use Wi-Fi sending to Blynk simultaneously with ESP-NOW sending to a remote ESP board?

    Thanks
    Mike

    ..

    Reply
      • I highly doubt that an ESP8266 can do ESP-NOW and WiFi at the same time.
        There are several sources that report it does NOT work with ESP8266s.
        The only way ro make it work ist setting mode to ESP-NOW for sending ESP-NOW then do a RESET and set to WiFi-mode and switching between these two modes always with RESETTING. Which is just a bad work-around.

        best regards Stefan

        Reply
  4. Hi,
    I need a help for this program. Iam facing issue in converting the esp8266’s MAC address from char to uint8_t format. Iam getting the mac from API response which is in String format. If i pass the string mac to esp_now_add_peer(), it is not accepting so if i tried to convert the string to uint8_t format by “(uint8_t) ” this format, it also not geting correct mac. Please help me to find solution for this issue

    Reply
  5. Hello,
    What about wrong MAC addresses?
    For example set in the master:
    uint8_t broadcastAddress1[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; // (or other wrong adresses)
    uint8_t broadcastAddress2[] = {0x4A, 0x3F, 0xDA, 0x4A, 0x26, 0xE8};
    Then my results are:
    Packet to:ff:ff:ff:ff:ff:ff send status: Delivery success
    Packet to:4a:3f:da:4a:26:e8 send status: Delivery success
    Thanks for your answer,
    Karoly

    Reply
  6. There is an error is a section of your write up:

    Do the same for the other boards. For the second board send the test2 structure:

    Original text:
    esp_now_send(broadcastAddress2, (uint8_t *) &test, sizeof(test2));

    Recommended correction:
    esp_now_send(broadcastAddress2, (uint8_t *) &test2, sizeof(test2));

    The full code listing is correct.

    V/r
    Curtis

    Reply
  7. Found another typo:

    Set the ESP8266 role. This is a receiver board, so set its role to ESP_NOW_ROLE_SLAVE.

    Original:
    esp_now_set_self_role(ESP_NOW_ROLE_CONTROLLER);

    Should be:
    esp_now_set_self_role(ESP_NOW_ROLE_SLAVE);

    Reply
  8. Dear Sara and Rui,
    thanking for grat tutorial, I have some questions for you:

    1 – what happens if “esp_now_add_peer” function fails ? I have to register 5 peers and sometimes it happens that one or more peers “fail” to be added.

    2 – in my code i send a broadcast message to all the 5 peers and than I put sender esp8266 in a while loop to wait the feedbacks from all the peers. This is a short extract:

    esp_now_send(0, (uint8_t *) &test, sizeof(test));
    tWait = millis() + 300;
    while (millis() <= tWait){
    yield();
    }

    Is it a correct coding way? Or, am I making some mistake? (I used while to avoid delay function)
    Are 300 millis of “waiting time” enough ?

    3 – Receiver side: I want that receiver stops running core until it receives a message from sender. Is it ok “locking” it in a while loop like this ?
    msgRcv is a “flag” variable that I include into OnDataRecv function ( if receiver receives a message –> msgRcv = true; )

    while(msgRcv == false){
    yield();
    }

    Thanks a lot in advance !
    Andrea

    Reply
  9. Facing a problem..
    From one NodeMcu to many is working fine with esp now. But when switching the master nodemcu for seperate x & y values through its IP address while connected from external WiFi router, not working.
    Showing ‘Delivery fail’
    .
    Initially it was Showing ‘Delivery success’.
    Can’t understand where is the problem.

    Reply
  10. Thanks you for this great website and this explanation of ESP-NOW. I’ve got it working using your one to many example and your code pretty much verbatim. But then I tried to add an OLED display, SSD1306, using the Adafruit libraries. The display works when starting up, early in the setup section. But the code I placed code to display the X,Y in the OnDataRecv function and when the display.display statement is executed, the program blows up with a “Panic core_esp8266_main.cpp:191 __yield”. Something is stepping on something, but I don’t know what. I tried to move the display code to it’s own function, called then from the OnDataRecv function, with the same result. Any help or insight would be very much appreciated.

    Reply
  11. I have been able to get you code to work, pretty much “as is” using it in a one to one relationship. I can transmit the random X,Y and receive them on receiver, displaying them via the serial monitor. Works, easy, thanks. But….

    I then added an OLED display (SSD1306 type), which I’ve used a bunch in the past and the wheels have fallen off. When I go to do put the display out (display.display), I get an exception error: User exception (panic/abort/assert), followed by: Panic core_esp8266_main.cpp:191 __yield, and a memory dump in hex.

    Any idea why? It would appear something is stepping on something else, but I can’t figure it out, the Exception Debug tool was not helpful

    Any help is appreciated
    Joe

    Reply
  12. hi i am trying to connect multiple nodemcu to one nodemcu and have two way communication between master and slave, is that possible

    Reply
  13. Hi,
    I copy our ESP8266 NodeMCU Sender Code and it works fine ! Thank you.
    (I flash only the sender code without any receiver connected. So I receive 2 “Delivery Fail” message; which is correct !)
    But when I extend with more receivers (maximum 20!) I noticed on the Arduino IDE Serial Monitor I receive only a maximum of 8 “Delivery Fail” message!
    It looks like a timing jam… Do you have an idea why.
    I would like to send data to 20 receivers IN THE SAME TIME! Can you provide me any help ?
    Thank’s

    Reply

Leave a Comment

Download Our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.