Hi, I’m a bit new to the Qwiic system so I’ve been scrolling throug tutorials for a while, but I seem to fail to find any example where two devices of the same type are serially connected by their qwiic ports. How would I specify in my Arduino code which unit is which?
In the example code the constructor LSM6DSO are used, but not connected to any port or anything. Therefore I do not know how I would add a second sensor object and be sure it’s connected to the second physical sensor.
The two devices will need to have two different I2C addresses. Some can be changed via software, others like the LSM6DSO need to have a jumper changed to change the address. There are also some devices that cannot have their address changed at all. For the LSM6DSO see the Jumper Pins section in the [Hookup Guide to see how to change the I2C address.
For the software, you need a 2nd variable of the same type and you have to specify the address in one (or both) when they are initialized (begin() call)
LSM6DSO dev1;
LSM6DSO dev2;
...
void setup() {
...
if (dev1.begin()) // Default address of 0x6B
Serial.println("dev1 ready");
}
if (dev2.begin(0x6A)) // Must be jumpered to use alternate address
Serial.println("dev2 ready");
}
...