Arduino Uno talking and hearing to and from a ATtiny85 via I2C.

Hello, I'm a newbee.

I'm trying to communicate between a Arduino Uno and several ATtiny85's with I2C.
On the internet I only can find examples of sending data from the Uno to the tiny and the ATtiny is responding to this info by lightning some LED's or switching some Relais. This is communicating in one direction.
I want to sent data from the Uno to the Tiny. The Tiny has to answer depending on this data.
For example, every ATtiny85, in the circuit, is measuring a value.
Then the Arduino Uno asks to give the result of this measurement, every hour, to every ATtiny on the I2C-line. So the Uno is asking for results.

Where can I find some info about communication between an Arduino Uno and an ATtiny85 via I2C?

Thanks.

Do you use the TinyWire library? (https://github.com/TheAlphaNerd/TinyWire)

This thread http://arduino.cc/forum/index.php/topic,160680.0.html contains a demo how you can request data from the I2C slaves. The slave cannot send data to the master without a request.

I get an Error message "OnRequest"

In the TinyWireS.h file is written:

  • onReceive and onRequest handlers are not implimented.

Where can I get a good library?

Here... this page points you to the updated library with OnRequest()... down at the bottom, a link.

http://playground.arduino.cc//Code/USIi2c

In case you missed it..

Basically, to send commands and get a reply, you combine the two examples sketches here..

with..

But, of course, using TinyWireS instead for Slave,

In case you get lost, this might help..

But don't be afraid to ask more questions if you need help. Good luck.

Thank you Borland.

I added some extra lines in a few "TinyWireS-files" and it works fine.
I do not understand why these lines are missing in the original files and what these lines do.
But I don't care, I can communicate between my ArduinoUno and my ATtiny's.

Thank you.

The forum is useless unless people share their work, good or bad. Not a good idea to critique other peoples work and time without detailed explanation of what's at fault. Don't be so selfish; show us what you've done so others can learn from your experience.

Oh sorry, I didn't mean to critique other people.
I thanked you for your help.
What I did, to solve my problem, is adding some extra lines in some TinyWireS-library-files. As explained on the websides you mentioned.
I only followed your instructions. No more no less.
So again thanks.

Glad to help, but you still haven't shared what lines you added.

Your actions imply that others may need to add the same lines to the library code. That's not helpful to others, and not in the spirit of a forum. On the links, there were examples using Wire.h with Arduino platforms; so what did you add to TinyWireS.h to make it like Wire.h?