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

Full example to make two Arduinos speak to each other? #1

Open
aidv opened this issue May 11, 2024 · 13 comments
Open

Full example to make two Arduinos speak to each other? #1

aidv opened this issue May 11, 2024 · 13 comments

Comments

@aidv
Copy link

aidv commented May 11, 2024

Hi, could you provide an example project where two Arduinos speak to each other?

I'm trying to understand how to both read and write data between two Arduinos using SoftI2C.

@yasir-shahzad
Copy link
Owner

yasir-shahzad commented May 12, 2024

Hi Aidv,

This SoftI2C library can be utilized as an I2C master, not as an I2C slave. Consequently, you cannot establish communication between two Arduinos using SoftI2C. If you wish to facilitate communication between two Arduinos, you'll need to employ hardware I2C on the slave node instead.

@yasir-shahzad
Copy link
Owner

yasir-shahzad commented May 12, 2024

So, if you need it, I can provide an example demonstrating communication between two Arduinos using SoftI2C on the master and hardware I2C on the slave.

@aidv
Copy link
Author

aidv commented May 12, 2024

Where is the official statement of this? And isn’t it technically possible to use a different software i2c with master functionality and use SoftI2C as software i2c slave?

@aidv
Copy link
Author

aidv commented May 12, 2024

So, if you need it, I can provide an example demonstrating communication between two Arduinos using SoftI2C on the slave and hardware I2C on the master.

Yes please it would be of great help

@aidv
Copy link
Author

aidv commented May 12, 2024

And btw, why don’t you add master mode for SoftI2C?

@aidv
Copy link
Author

aidv commented May 12, 2024

I just re-read the README, and nowhere is there a statement that SoftI2C is slave-only.

@yasir-shahzad
Copy link
Owner

Sorry, I wrote the statement incorrectly. Actually, this library only works for I2C master, not slave.

@yasir-shahzad
Copy link
Owner

Sure, I will add the example of communication between two Arduinos tomorrow.

@aidv
Copy link
Author

aidv commented May 12, 2024

Thanks. Could you add slave support in the future?

@yasir-shahzad
Copy link
Owner

Sure, I will.

@aidv
Copy link
Author

aidv commented May 12, 2024

Sure, I will.

That woulf be great. Thanks!

I have this weird project where I need more i2c buses than available on the mcu that I need to use, and I can’t use a different mcu either.

@dave-aragon
Copy link

dave-aragon commented May 13, 2024

Thanks from me too, Mr. Shahzad, for the code here already, and any additional features you decide to undertake.

I see the benefit of a software peripheral ("slave") side in these terms: because I2C operates right down on the wires and pins, the best-suited peripheral devices are simple. They're so hard-wired that aidv's use case can be provoked simply by putting more than one of the same type of peripheral on a bus. Because that's a common problem, someone invented I2C bus multiplexers (or fanouts), and that's what I would use for that purpose. But for any other thing that we, as developers, might think to do in an I2C peripheral, we're stuck at the gate, because nothing that hangs from an I2C bus will let us blow any firmware onto it.

[Formally, perhaps I should have opened an issue for the feature request. It isn't a bug, and the title of this issue doesn't imply it. But I think the feature request has informally already been made and accepted.]

@aidv
Copy link
Author

aidv commented May 14, 2024

@dave-aragon I agree. In my case, the I2C buses can be slow, they don't even have to be all that fast.

My devices will be sending data between each other at most once a second and the size of the data buffer will be small, maybe 10 bytes at most

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

No branches or pull requests

3 participants