How to select a different I2C bus with the VL53L0X

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
femondra
 
Posts: 2
Joined: Sat Jun 08, 2019 7:36 pm

How to select a different I2C bus with the VL53L0X

Post by femondra »

Hello, I'm trying to set up a VL53L0X Time of Flight Sensors on a different I2C bus, but I am not fully understanding how to do that. I can see that you should be able to do it when calling begin() as seen here: https://github.com/adafruit/Adafruit_VL ... 3L0X.h#L41

Code: Select all

class Adafruit_VL53L0X
{
  public:
    boolean       begin(uint8_t i2c_addr = VL53L0X_I2C_ADDR, boolean debug = false, TwoWire *i2c = &Wire);
    boolean       setAddress(uint8_t newAddr);
What exactly do you pass into begin() to select for example the wire1 i2c bus? I've tried variations of begin(TwoWire i2c = &Wire1) to no avail, but I also don't fully understand what I am doing here.

User avatar
adafruit_support_carter
 
Posts: 29159
Joined: Tue Nov 29, 2016 2:45 pm

Re: How to select a different I2C bus with the VL53L0X

Post by adafruit_support_carter »

Try something like:

Code: Select all

lox.begin(VL53L0X_I2C_ADDR, false, &Wire1);

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”