Arduino Uno Simultaneous Multiple Soft I2C Library

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
pak_engineer
 
Posts: 1
Joined: Mon Feb 20, 2012 7:11 pm

Arduino Uno Simultaneous Multiple Soft I2C Library

Post by pak_engineer »

Hi,

There are a lot of I2C libraries for Arduino on internet but there is one problem - none of them supports multiple I2C to communicate to devices simultaneously. I needed a library of I2C that could communicate to multiple sensors (having same address) using a single Arduino and much to my disappointment, I couldn't find one. I kept on searching and the best closest thing I could find is 'softi2c' library by fat16lib.

http://forums.adafruit.com/viewtopic.php?f=25&t=13722

I tweaked it a little bit to be able to handle multiple I2C buses at the same time. All buses have software selectable pins and they can either have a shared or independent SCL pins, depending on user requirement. The example code is for VCNL4000. In the example I haven't written different functions for read and write but of course it can be modified. I did it because the sensor is in proximity mode and the Command Register needs to be written each time prior to a valid read. The code is tested for Arduino 1.0. Hopefully this helps.
Attachments
SoftI2cMaster.rar
VCNL_example is inside the SoftI2cMaster folder.
(3.7 KiB) Downloaded 186 times

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”