I am looking at using I2C to transfer data between an ESP32 as the master and an ESP8266 as the slave. When my sketches to transfer data did not work I created 2 simple sketches as follows
I have checked the wiring between the devices and all looks OK using the pins mentioned in the comments for each sketch and there is a common GND connection between them. Adding 10K pullup resistors to the SDA and SCL lines makes no difference
Running the scanner on either board with an I2C device attached finds the device and correctly reports its address, so I am confident that the correct pins are being used on both of them
Can anyone see anything obviously wrong either with the hardware setup or the sketches ?
You mention the ESP32 as a master, but the Wire.begin(99); statement sets it up as a slave with address 99.
Similarly, the Wire.begin(); statement for the ESP8266 sets it up as the master.
There seems to be a dearth of information about I2C slave mode on ESPs. I have certainly seem mention of the lack of slave mode on the ESP8266 and I can't get it working on the ESP32 either. As a quick reality check I tried it on a pair of Nanos and it worked straight away
I will try again but as it happens I have used a serial connection instead of I2C where I wanted it
A serial connection will be much easier to program.
Alternatively ESP8266 / ESP32 offers a wireless protocol called ESP-NOW.
As long as you don't want to use WiFi-WLAN and ESP-NOW in parallel this would be an option too.
unfortunetely ESP-NOW can only be used mutually exclusive. Which means ESP-NOW or connecting to a WiFiRouter
Where have you read it is possible ? I mean the ESP32 as I2C Slave.
As far as I know someone got it working, but not with the normal libraries. I don't know the current status for the ESP32, so perhaps they have implemented it.