Arduino-EasyTransfer icon indicating copy to clipboard operation
Arduino-EasyTransfer copied to clipboard

Can slave of i2c send data to master?

Open khoindq opened this issue 9 years ago • 3 comments

Hi all, i would like to use i2c to send data from a slave to master, how can I achieve that, I read that using wire request can solve those problem . However I dont know how to use that with easy transfer

khoindq avatar Jan 28 '16 09:01 khoindq

Hello, I have the same problem of you and I have found a solution that I can share if someone else would do the same thing : You just have to define an adress of the MASTER, like that : Wire.begin(I2C_MASTER_ADDRESS); and you send your slave data to this adress and it's work perfectly : ET.sendData(I2C_MASTER_ADDRESS); And in your master code you wait the reception with this code if(ET.receiveData()){...}. If you have question don't hesitate. I hope that can help and sorry if my English is not very good (I am French :-D ).

P.S : I attach an example where I send data in both direction Master to slave and Slave to Master and the data have a type different (float, int, boolean) !

I2C_example_MS&SM.zip

MG-Arnaud avatar Aug 03 '17 17:08 MG-Arnaud

Thanks a lot ArnaudProjetAPP, you probably just save a few hours of my life! I think this should def. be included in the examples!

r0oland avatar Apr 01 '18 10:04 r0oland

Hello r0oland, you're welcolme :-) Thank you for your comment, it makes me happy if I could help you !

MG-Arnaud avatar Apr 01 '18 10:04 MG-Arnaud