Hello!
I found this tutorial:
I can use this to comunicate both ways?
I can use the slave only as input pins? Can i use the second board to control something like relays, LED, displays, etc?
Hello!
I found this tutorial:
I can use this to comunicate both ways?
I can use the slave only as input pins? Can i use the second board to control something like relays, LED, displays, etc?
The main thing is that the master provides the clock that is used by slave to clock in data send by the master or clock out data that the master wants to receive.
So yes, you can communicate both ways. But it is always initiated by the master. A slave can not call the master on the I2C bus and say 'here is some data'; the master will call the slave and say 'I need some data'.
You can add a third connection (not as part of the I2C bus) between the master and the slaves that allows the slaves to notify the master that they have data available. The master can poll that line or you can use an interrupt.
The slaves can do anything; provide information about the state of buttons, control relays and LEDS etc, do calculations or whatever.
i have a uno board connected to internet and i used all pins. i need extra board to connect a display, some buttons, and a sensor.
Can i write the program for the display on the slave arduino and get text data from master arduino?
Yes.
Arduino's are relatively expensive; you can use I2C port expanders or shift registers (e.g. 74HC595 serial-in/parallel-out and 74HC165 parallel-in/serial-out)) to extend the IO capabilities of one Uno.
There is an I2C LiquidCrystal library somewhere as well, so you can try to find an I2C based LCD (it's basically a port expander connected to a LCD display).
rotarucosminleonard:
I have a UNO board connected to internet and I used all pins.
If you used all the pins, you have nothing with which to communicate with another Arduino.
Snookered!