gutierrezps / ESP32_I2C_Slave

I2C slave library for ESP32
GNU Lesser General Public License v2.1
81 stars 20 forks source link

Found this library #11

Closed pe1mxp closed 3 years ago

pe1mxp commented 3 years ago

I have 2 UNO's talking with eachother with I2C. Both are standard in Slave_Receiver. But when one of them has data it will change to Master_Writer, send the 6 bytes data and the turning back to Slave_Receiver. This works great on 2 UNO's. But because I run out of memory on one UNO I exchanged it for an ESP32. And then came the problems. Compared both WIRE libraries and there is indeed some lack of programming. As for now I go testing with the library unless there is another solution for onRequest()/onReceive.

gutierrezps commented 3 years ago

I don't think I2C is the right protocol for your application. I2C devices are not meant to switch roles dynamically. It is possible to have two I2C masters on the same bus (MultiMaster mode), but I don't think it's possible with ESP32. What you're looking for is Serial, or some other bidirectional asynchronous protocol. Use a Software Serial library both on Arduino Uno and on ESP32 to keep using the default Serial ports for PC communication.