madsci1016 / Arduino-EasyTransfer

An Easy way to Transfer data between Arduinos
http://www.billporter.info/easytransfer-arduino-library/
320 stars 114 forks source link

Bidirectional data sharing? really need this for my project... #16

Open RootlessAgrarian opened 7 years ago

RootlessAgrarian commented 7 years ago

EasyTransfer I2C is great and I have been using it successfully with master transferring data to slave. However I have recently had to shuffle functions around between duinos in my project and it's no longer possible to have one I2C master in possession of all relevant data; the slaves now are reading sensors of their own and should report some data back to the master, as well as receiving data from the master.

I was hoping that there was a (master) function ET.requestData(I2C_SLAVE_ADDRESS) but alas it does not seem to exist yet. I had hoped that I could define the shared data struct, write certain values at the slave end, request the struct from the slave, read it on the master, write certain other value at the master end, send it to the slave, and so on. Having the master drive the timing of this conversation is fine, I don't need the slaves to initiate any events.

Is it possible (please) to do this? I am not an advanced Arduino hacker or a very gifted C programmer, but if I had a bit of sample code I could definitely adapt it.

RedyAu commented 7 years ago

It can do that. See 2Way example in the original version's folder.

nielsnl68 commented 7 years ago

Hi, i have the OP, i have one master i2c arduino and multiple client arduinos what is not easy to work wirh when the clients need to update the master frequently.

When i read the code you suggested, then the communicatie will by serial between two arduinos and that is not what th OP and i needs.

Or did you refar to an other example?

RedyAu commented 7 years ago

The library works the same way on every communication system (serial, i2c, soft-serial...). Download and use the one you need. Edit: Oh! I see. There is no example for i2c. Well, then reuse the logic code, and not the including and configuration from the serial one.

MG-Arnaud commented 6 years ago

Hello,

if you would like, you can find my example and the explications on this issue : https://github.com/madsci1016/Arduino-EasyTransfer/issues/9

I2C_example_MS.SM.zip