Closed libbierose86 closed 1 year ago
Pass the non-default bus in as a parameter to begin()
. Default is Wire
.
https://adafruit.github.io/Adafruit_AS7341/html/class_adafruit___a_s7341.html#ae363bc9fd58634da9ac1701cc69b9dff
\
Ex, assuming sensor_one
is on Wire
and sensor_two
is on Wire1
:
if (!sensor_one.begin()){
Serial.println("Could not find AS7341");
while (1) { delay(10); }
}
if (!sensor_two.begin(AS7341_I2CADDR_DEFAULT, &Wire1)){
Serial.println("Could not find AS7341");
while (1) { delay(10); }
}
Using an I2C muxer is suggested as a better solution to this: https://learn.adafruit.com/working-with-multiple-i2c-devices
Hi,
Thanks I did try that, think I must have an issue somewhere else and I just went down the wrong rabbit whole for what the issue is. Even if I do just one sensor using the library the serial stops working with windows saying that the Device Descriptor Requested Failed.
Sounds like something more basic is happening. Please post in the forums with photos of your setup: https://forums.adafruit.com/
Just tested the basic_counts
example a Pi Pico with AS7341 on pins 4 (SDA) and 5 (SCL) and it works as expected:
F2 445nm : 0.01
F3 480nm : 0.01
F4 515nm : 0.05
F5 555nm : 0.10
F6 590nm : 0.03
F7 630nm : 0.21
F8 680nm : 0.03
Clear : 0.07
NIR : 0.03
Hi, I will do later.
If I run the example with no changes its fine, for one sensor it is fine. When I try to set SDA and SCL to different pins it stops working. I might just do it without the library, I know I can see the sensor and confirmed they are talking without it. Was just hoping to save a bit of time.
Thanks
Libbie
Hi I was wondering it possible to us this library to read from two different sensors on to different i2c buses, I'm using a pico and am able to scan both the buses and see that the sensor are there, I just can not figure out if I'm able to define which I2C is is used at the begin().