Closed lemorage closed 4 months ago
The following is the same as the figure above:
/**
* @brief Constructor
* @param pWire - Wire object is defined in Wire.h, so just use &Wire and the methods in Wire can be pointed to and used
* @param i2cAddr - SCD4X I2C address.
*/
DFRobot_SCD4X SCD4X(&Wire, /*i2cAddr = */0x62);
So actually we can pass in another i2c address to override the default one, like this SCD4x scd4x(&Wire, 0x70);
. Is it right?
Sorry, I misunderstood your meaning earlier. This interface can be considered a reserved feature, supporting potential other SCD4x series sensors with different I2C addresses. However, according to the information provided in the chip manual, the SCD4x should only support the unique I2C address 0x62. Therefore, I'm just using a macro to represent its address.
alright, that makes sense to me. actually, I am thinking of the same problem that it seems we can only change the address physically, anyways, thanks for the reply.
If you need to use two i2c sensors at the same time because the address is the same, and can not be changed, you can try using this type of module: https://www.dfrobot.com/product-1780.html
Yeah, it looks like this is the standard way to resolve this. I'm not up for adding complexity, but anyway, I'll give it a try. Thanks for the info.
The information on my SCD41 sensor tells me the default I2C address is 0x62, however, I want to change it to another address. I wonder if we can use the constructor provided by the library to change the
SCD4X_I2C_ADDR
and how to do it (since I didn't see there is an example doing this)?