I2C Interfacing Arduino and Si1133

Hello everyone,

I have been working on a project that includes a UV sensor, specifically Si1133 (follow the link for the datasheet if you need it). It uses an I2C protocol.
The thing is that this is my first time working with I2C and I am having some problems in figuring out the coding. All the examples that I found are of the digital potentiometer or the temperature sensor.

I have been cracking my head for the past 5 days.
Can you please check my code and let me know. The error is highlighted in the code.
Another thing that I want help with is how to get the UV index from the sensor, which I think is HOSTOUTx.
I am not sure if or how to use the interrupts.

#include <Wire.h>


#define Si1133_addr 0x52  //From Datasheet
#define CHAN_LIST 0x01    //From Datasheet
#define CHAN_LIST_Set 0x04 //Set by user
#define INPUT0 0x0A       //From Datasheet
#define COMMAND 0x0B      //From Datasheet
#define COMMAND_START 0x13  //From Datasheet
#define RESPONSE0 0x11    //From Datasheet
#define RESPONSE0_Res 0x0F //From Datasheet
#define ADCCONFIG2 0x0A   //From Datasheet
#define ADCCONFIG2_Set 0x18 //Set by user
#define ADCSENS2 0x0B     //From Datasheet
#define ADCSENS2_Set 0x02 //Set by user
#define ADCPOST2 0x0C     //From Datasheet
#define ADCPOST2_Set 0x00 //Set by user
#define MEASCONFIG2 0x0D   //From Datasheet
#define MEASCONFIG2_Set 0x3C  //Set by user
#define IRQ_EN 0x0F     //Set by user
#define IRQ_STATUS 0x12 //From Datasheet
#define IRQ_STATUS_PINS 0x04  //Set by user
#define HOSTOUT0 0x13   //From Datasheet
#define HOSTOUT1 0x14   //From Datasheet
#define HOSTOUT2 0x15   //From Datasheet
#define HOSTOUT3 0x16   //From Datasheet
#define HOSTOUT4 0x17   //From Datasheet
#define HOSTOUT5 0x18   //From Datasheet
#define HOSTOUT6 0x19   //From Datasheet
#define HOSTOUT_Res 0x00 //From Datasheet


void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
Wire.begin();
delay (30);
}

void loop() {
Wire.beginTransmission(Si1133_addr);
delay(30);
Wire.write(0);
Command(ADCCONFIG2, ADCCONFIG2_Set, 1);   //Used to configure channel 2
Command(ADCSENS2, ADCSENS2_Set, 1);       //Used to configure channel 2
Command(ADCPOST2, ADCPOST2_Set, 1);       //Used to configure channel 2
Command(MEASCONFIG2, MEASCONFIG2_Set, 1); //Used to configure channel 2
Command(COMMAND, COMMAND_START, 0);       //Sets START in the COMMAND register to start the autonomous mode
Wire.endTransmission();
}

void Command(byte Address, byte Code, int layer) 
//Receives the "Address" of the register to address. 
//The "Code" needed to send to the specific register. 
//"Layer" is used for accessing different layers of registers. 
//Some registers are access using INPUT0, then sent the command found in COMMAND

{ byte counter=0;
  int a=0;
  
  if(layer ==0) //Used to write directly into COMMAND register, to START, FORCE,...
  { Wire.write(COMMAND); 
    Wire.write(Code);
  }
  
  if(layer!=0)  //Used to access the registers that can be access indirectly. Check fig 5.2 (page 11) in datasheet.
  { while(counter ==0)
    { Wire.requestFrom(Si1133_addr, 1);
      while (Wire.available()){
      byte counter=Wire.read(RESPONSE0);  //<<=== having problem here. This is supposed to be used to check the ACK. 
                                          //Giving "no matching function for call to 'TwoWire::read(int)" error
      }
      Wire.write(INPUT0);   //set to Write into register INPUT0
      Wire.write(Address);  //Write pointer to which register the command is sent to
      Wire.write(COMMAND);  //set to Write into register COMMAND
      Wire.write(Code);     //Write the code to se register the command is sent to
      a++;
      delay (20);
      if (a=10) //Resets CMMND_CTR on Si1133 after 200ms 
      {  Wire.write(RESPONSE0);
         Wire.write(RESPONSE0_Res);
         a=0;
      }
      //Resets the ACK counter on Si1133
      Wire.write(RESPONSE0);
      Wire.write(RESPONSE0_Res);
    }
  }
}

Wire.read() does not want an argument as it's (void). You have to tell the sensor previously what data you want when you execute the Wire.requestFrom(Si1133_addr, 1) statement.

Is there a way to specify which address I want a reply from?

You're already addressing the right device with the 'Wire.requestFrom(Si1133_addr, 1);' command. You just need to remove 'RESPONSE0' from the 'Wire.read' command. The returned value will end up in 'byte counter'. You must tell the device previously what value you want it to return. Wire.read() does not want an argument as the error message implies.