Hello,
I'm having trouble trying to interface my Arduino MKR WiFi 1010 with a sensor via i2c protocol when running a program including the WiFiNINA library. When I upload the sensor test sketch I get the correct values but when I upload another program with the WiFiNINA library, the serial monitor shows incorrect values even though minutes before it was working well with the first sketch and the connections are ok.
I noticed that the i2c address of the sensor is 0x60 in the sensor's datasheet and when I scan i2c devices without any device connected I found that there are two default ones (0x60 and 0x6B) and when I connect the sensor and run the scanner sketch again I get the same result. So I supposed that the problem is that when working with the Arduino internal device with the address 0x60 (I assumed that the WiFi device is that one), it interferes with the sensor and as a result I have incorrect values.
Is there any way I can change that address 0x60 of the Arduino device or how can I do to interface my Arduino with that sensor. I assumed that changing the address of the Arduino could be a solution because I wasn't successful trying to change the sensor's address.
The sensor I used was the SI1145 Grove - Sunlight sensor and I use the SI114x.h library.
This is the sensor test sketch:
/*
This is a demo to test Grove - Sunlight Sensor library
*/
#include <Wire.h>
#include "Arduino.h"
#include "SI114X.h"
SI114X SI1145 = SI114X();
void setup() {
Serial.begin(115200);
Serial.println("Beginning Si1145!");
while (!SI1145.Begin()) {
Serial.println("Si1145 is not ready!");
delay(1000);
}
Serial.println("Si1145 is ready!");
}
void loop() {
Serial.print("//--------------------------------------//\r\n");
Serial.print("Vis: "); Serial.println(SI1145.ReadVisible());
Serial.print("IR: "); Serial.println(SI1145.ReadIR());
//the real UV value must be div 100 from the reg value , datasheet for more information.
Serial.print("UV: "); Serial.println((float)SI1145.ReadUV()/100);
delay(1000);
}
Serial monitor with the sensor connected and the same result when only the Arduino working.