Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make requests to I2C slaves #81

Open
TurboNerd95 opened this issue Jan 21, 2022 · 4 comments
Open

Make requests to I2C slaves #81

TurboNerd95 opened this issue Jan 21, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@TurboNerd95
Copy link

TurboNerd95 commented Jan 21, 2022

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).

@PowerBroker2 PowerBroker2 self-assigned this Jan 21, 2022
@PowerBroker2 PowerBroker2 added the enhancement New feature or request label Jan 21, 2022
@fif911
Copy link

fif911 commented Jan 22, 2023

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.

@TurboNerd95
Copy link
Author

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.

@fif911
Copy link

fif911 commented Jan 28, 2023

@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
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants