Bidirectional I2C communication between ESP32 and Arduino nano

Hello, I’ve had some luck using the I2C_anything Library to send multiple floating variables from an ESP32 Master to 2 slave arduino Nano’s. In the example below, the first slave is sending AC current readings to the ESP.

Master ESP32 code;

#include <Wire.h>
#include<I2C_Anything.h>

float x1; 
float x2;
double c1;
float c2;

void setup()
{
  Wire.begin();
  Serial.begin(9600);

}

void loop(){
transmission();

}

void transmission(){
  Wire.requestFrom(0x08, 8);
  I2C_readAnything(x1);
  I2C_readAnything(c1);
  Serial.println("Data received from Slave1...!");
  Serial.println(x1, 2);
  Serial.println(c1, 2);
  //----------------------
  Wire.requestFrom(0x09, 8);
  I2C_readAnything(x2);
  I2C_readAnything(c2);
  Serial.println("Data received from Slave2...!");
  Serial.println(x2, 2);
  Serial.println(c2, 2);
  delay(100);
}

Slave Arduino 1

#include <Wire.h>
#include<I2C_Anything.h>
#include "EmonLib.h"                   // Include Emon Library
EnergyMonitor emon1;                   // Create an instance
float x1;
double c1;
  
void setup()
{
  emon1.current(1, 111.1);
  Serial.begin(9600);
  Wire.begin(0x08);
  Wire.onRequest(sendEvent);
}

void loop()
{
 
  double Irms = emon1.calcIrms(1480);
  x1 = 19.36;
  c1 = Irms;
  
  delay(100);  
}

void sendEvent(int howMany)
{
  I2C_writeAnything(x1);
  I2C_writeAnything(c1);
}

that code was manipulated from here; https://forum.arduino.cc/index.php?topic=610175.0

However, I was wondering if there was any way to be able to send additional floating variables from the ESP32 back to the Slaves using I2C, so there is bidirectional communication? Perhaps there’s another thread out there with someone achieving this that I could be linked to?

thank you!

I found this very helpful example https://forum.arduino.cc/index.php?topic=126936.msg955223#msg955223.

However, it only compiles for the ESP8266 board, and not the ESP32. I get the following error for the ESP32;

"undefined reference to `TwoWire::onReceive(void (*)(int))'"

It seems like the Wire.onReceive function doesn't work with the 32, but does with the 8266.