I have been trying to figure this out on my own, but I just can't seem to find the info on the net. I have two MLX90614 sensors each hooked to a pair of digital pins on my Arduino Mega. I am very successful at talking to each one individually, but haven't figured out how to get the code to talk to one, and then the other within the same program.
Excerpt from the library file
/* In order to use the library, you need to define SDA_PIN, SCL_PIN,
- SDA_PORT and SCL_PORT before including this file. Have a look at
- http://www.arduino.cc/en/Reference/PortManipulation for finding out
- which values to use. For example, if you use digital pin 3 for
- SDA and digital pin 13 for SCL you have to use the following
- definitions:
- #define SDA_PIN 3
- #define SDA_PORT PORTB
- #define SCL_PIN 5
- #define SCL_PORT PORTB
It seems it wants a global definition to the pins to use for the I2C port. And from what I can understand that makes it fixed with those pins throughout the sketch. I am hoping to have two separate soft I2C ports. I was hoping to have a function that would be passed the port pins to use, and return with a temperature reading from my MLX90614. I really don't want to add anymore hardware to switch between I2C devices.
Is there another softI2C library that allows this? Or is my understanding of this library missing something? I saw talk of it, but could never find it. I'm hoping someone can point me in the right direction.
Thanks,
MAB