Make requests to I2C slaves
Hello,
Very good job with the library. I had a lot of struggles interconnecting Arduino's when I started out and this eliminates the trouble.
I also think there should be a way for this library to incorporate the "Wire.requestFrom()" function from the Wire library, which allows a master Arduino to collect data from 1 or more I2C slave Arduino's, while also being able to transmit data to them. This would allow for 2 way communication, without the need to use multi-mastering (potentially unreliable).
Hey @TurboNerd95. Were you able to make one master multiple slaves communication? That's what I need now, and I hope there is a way to use this lib for it.
Hey @TurboNerd95. Were you able to make one master multiple slaves communication? That's what I need now, and I hope there is a way to use this lib for it.
Yes, there is an additional argument in the sendData function (targetAddress), which allows the master to send to multiple slaves:
uint8_t I2CTransfer::sendData(const uint16_t& messageLen, const uint8_t& packetID, const uint8_t& targetAddress){
However, the "request" function I was asking about doesn't seem to be implemented yet.
@TurboNerd95 Hey, thanks. I was able to discover that on the day I asked but now struggling to implement Slave to Master communication. Were you able to implement this request function somehow, or you used another solution? That's the same thing I also need now :)
@TurboNerd95 Hey, thanks. I was able to discover that on the day I asked but now struggling to implement Slave to Master communication. Were you able to implement this request function somehow, or you used another solution? That's the same thing I also need now :)
I just ended up using the basic wire.h, in order to request data from the slave's. Here is a comprehensive set of examples: https://forum.arduino.cc/t/use-i2c-for-communication-between-arduinos/653958.