Hi there! I am trying to connect an AS7331 UV sensor to an Arduino R4 WiFi’s QWIIC connector (wire1), and cannot find how to set it up on Wire1. I am also using a SSD1306 OLED on the same wire1 bus (Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire1, -1);).
I have set up the sensor per the Sparkfun Arduino library ( SfeAS7331ArdI2C myUVSensor; ), but do not know where to tell it to use I2C1 bus. Hopefully this will be a quick and easy answer. Thank you for your help.
This line of library code is the critical one. If your sensor is using the default 0x74 address, your code will be:
Wire1.begin();
// Initialize sensor and run default setup.
if (myUVSensor.begin(0x74, Wire1) == false)
{
Serial.println("Sensor failed to begin. Please check your wiring!");
Serial.println("Halting...");
while (1)
;
}
Yes, that did the trick! The sensor arrived today and is displaying reasonable UV numbers. It took some searching to find what units were being displayed (microwatts per square cm), but I added it to the OLED display. Thank you for the help.