Can't read sensor using I2C


I just want to get data from a RGB sensor (MAX44005). Here is a link to its datasheet.
I tried to use the Wire library but it needs a Repeated Start condition which is not supported in the library. That or I just don’t know how to do it. So I found and used the SoftI2CMaster library.

Here is my test code:

#define SDA_PIN 4
#define SCL_PIN 5
#include <SoftI2CMaster.h>
#define I2C_FASTMODE 1 

byte sense[]={0,0,0};
byte a=68;
byte o=6;

void setup() {

void loop() {
  for (int i=0; i<3;i++){
  delay (10);

It suppose to show me the bytes from specific registers. It just say “Sensing…” and then nothing.

I tried to see if connections and circuitry is at fault but when I used a I2C Scanner using the Wire library it can find it. But when I used the I2C Scanner example from the SoftI2CMaster it says:

“Initialization error. SDA or SCL are low”

I don’t get any errors when I compile so I don’t know what is wrong. I really don’t know how to use the SoftI2CMaster Library. I am really kinda new to this. :stuck_out_tongue:

Any help would really be appreciated! Thanks!

I think this is supposed to be a function call.

// like this

The I2C bus requires pullup resistors on both the SDA and SCL lines. The hardware I2C bus has them in the processor, but this software version probably does not. You might be able to set the pinMode to activate the internal pullups.

Thanks for the reply!

But it still doesn't work. I tried using the internal pullups and also tried using external pullups.
Maybe I am using the library wrong? o.O