How to code x2 l2C sensors (RTC & sunlight)

hi there, I wonder if I need to implement any semaphore when using more than 1 l2C sensors since they are serial, or can I just use them after other calling their address?

thanks in advance

Hi @annlee,

Technically, the hardware I2C on the Raspberry Pi is thread-safe, so you won’t need a mutex on that.

On the other hand, the operations you issue for I2C devices need to use a mutex in order to be able to use them concurrently - the reason is that you don’t want to start communicating to a device when another one is doing its configuration because that would break it.

Hope this makes sense to you.

Thank you!