Hi, I'm new to arduino and am having trouble grasping how to get multiple i2c slaves communicating on the same bus. (The current slaves I am using are the I2C LCD, DS3231 and the gyroscope that comes with the starter kit).
I'm aware of the concept of how i2c operates but I am having trouble finding useful tutorials or information online.
I'm in need of example code to read through and grasp. Any help or links to useful resources will be greatly appreciated.
The Arduino board is the Master ? then there is no problem.
The libraries that communicate via the I2C bus, can communicate with the display and the RTC and the sensor(s) without problem. They do not get mixed. Just use it and it will be okay.
It is not possible to use a I2C sensor from an interrupt routine. That would mess up things really bad.
When using a preemptive multitasking operating, and different tasks use the I2C bus at the same time, that is also not possible.
With the Arduino it is very simple. You use a function from a library, that function from the library communicates with the I2C device (display or sensor) and after that is finished you can call a function from another library for another I2C device. Nothing is mixed, nothing bad happens.