pi3g / bme68x-python-library

Python 3 Library for BME688 and BME680 (Bosch Sensortec sensors), supports Bosch BSEC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fixed i2c port

danielfett opened this issue · comments

It was surprising to see that the I2C port/bus cannot be defined during run time. Usually, python interfaces for i2c devices accept both an i2c address and a port/bus number.

To change the i2C port and address requires the current instance to be closed and a new one opened
This is an example open
bme = BME68X(cnst.BME68X_I2C_ADDR_LOW, 0)

And this will close it
bme.close_i2c()

Re-starting the i2c will loose state and there will be a new stabilisation period, but hopefully a short one.

I am not sure what your use case is, but I have run two BME688 sensors on the same I2C bus (different addresses) collecting data using one python script. I also run I2C Bus 3 with a pm25 sensor which runs at 100khz , and the standard I2C Bus with faster sensors such as the BME 688.

Keith