Interconnecting two Arduino with NodeMCU

I am working on a project in which I want to send information between Arduino to other Arduinos via WIFI. I’m new in I2c communications. I am using NodeMCU and Arduino Uno, my idea is to send the data collected by the Arduino to the NodeMCU with the serial communication, the NodeMCU will send the data to more NodeMCU and send via serial to the Arduino Uno. I mean, every Arduino will be connected to one NodeMCU, the Arduino needs to read and send data to a single NodeMCU and the NodeMCU need to read and send data to the Arduino and other NodeMCU.

To make this I am using the painless mesh library and wire libraries. The Arduino Uno is sending a digit by the serial (I tried the same with the serial communication between two Arduinos), but my problem is that the NodeMCU can’t understand the Arduino and less send the data to other NodeMCU.

// NodeMCU
#include <Wire.h>

#include "painlessMesh.h"

#define   MESH_PREFIX     "RedNodeMCU"
#define   MESH_PASSWORD   "123456789"
#define   MESH_PORT       5555

int inputNumber = 0;
int outputNumber = 0;

Scheduler userScheduler; // to control your task
painlessMesh  mesh;

// User stub
void sendMessage() ; // Prototype so PlatformIO doesn't complain

Task taskSendMessage( TASK_SECOND * 1 , TASK_FOREVER, &sendMessage );

void sendMessage() {
  String sendNumber = (String) inputNumber;
  mesh.sendBroadcast(sendNumber);   /*Send a digit to every NodeMCU conected to the mesh*/

// Needed for painless library
void receivedCallback( uint32_t from, String &msg ) {
  Serial.printf("startHere: Received from %u msg = %s\n", from, msg.c_str());

void newConnectionCallback(uint32_t nodeId) {
  Serial.printf("--> startHere: New Connection, nodeId = %u\n", nodeId);

void changedConnectionCallback() {
  Serial.printf("Changed connections\n");

void nodeTimeAdjustedCallback(int32_t offset) {
  Serial.printf("Adjusted time %u. Offset = %d\n", mesh.getNodeTime(), offset);

void setup() {
  Serial.begin(115200); /* Begin serial for debug */
  Wire.begin(4, 5);     /* Join i2c bus with SDA=D1 and SCL=D2 of NodeMCU */

  mesh.setDebugMsgTypes( ERROR | STARTUP );  // set before init() so that you can see startup messages

  mesh.init( MESH_PREFIX, MESH_PASSWORD, &userScheduler, MESH_PORT );

  userScheduler.addTask( taskSendMessage );

void loop() {

    Wire.beginTransmission(8); /* Begin with device address 8 */
    Wire.write(outputNumber);  /* Sends a number to the Arduino*/
    Wire.endTransmission();    /* Stop transmitting */
    Wire.requestFrom(8, 1);    /* Request & read data of size 1 from Arduino*/
    while (0 < Wire.available()){
    int inputNumber =; /*Read data from Arduino*/
  Serial.print("Input Number: ");

The code shows no error because I understand that the function sendBroadcast will send a String, so I made that the integer change by the cast to a String. I have read several forums and saw some youtube videos for help but I don’t found something similar to my problem.

Thanks a lot for your help.