ESP32 as I2C slave not working: Wire.onRequest() not implemented.

My ESP8266 is I2C master while requesting data from sensors.
ESP8266 needs to get one byte from ESP32 also.

However, it looks like Wire.onRequest() is not implemented in ESP32 Arduino core and therefore ESP32 doesn’t work as slave.

Is there a way I can go around this problem somehow?
I just need one byte back from ESP32 on ESP8266 request.

The I2C example sketch below returns compiling error in ESP32:
“ESP32_I2C_slave_test1.ino:16: undefined reference to `TwoWire::onRequest(void (*)())’”

#include <Wire.h>

void setup() {
  Wire.begin(8);                // join i2c bus with address #8
  Wire.onRequest(requestEvent); // register event
}

void loop() {
  delay(100);
}

// function that executes whenever data is requested by master
// this function is registered as an event, see setup()
void requestEvent() {
  Wire.write("hello "); // respond with message of 6 bytes as expected by master
}

As far as I know the ESP hardware doesn't support I2C slave mode. Theoretically you can emulate that in software (the ESP hardware should be fast enough for that) but that's a quite complicated task. It might help to tell us why you think you need that feature. There may be other solutions to your problem.

I need to get one byte from ESP32 to ESP8266 via I2C.

Who can respond to Wire.requestFrom() command issued by a Master?

1. An active slave like another Arduino UNO/NANO/MEGA or any other processor with I2C logic circuitry.

2. A passive slave like DS3231 RTC or 24C512 EEPROM will not respond to the Wire.requestFrom() command though they have the I2C logic circuitry.

Please check the data sheets of Tensilica Xtensa LX6 microprocessor of your ESP32 Module if the microprocessor contains I2C interface.

I need to get one byte from ESP32 to ESP8266 via I2C.

Change the interface. I2C is a bad choice.