adafruit / Adafruit_BME280_Library

Arduino Library for BME280 sensors
Other
333 stars 304 forks source link

have 2 BME280 by 0x76 and 0x77 simultaneously side by side on same i2c Bus? #31

Closed tofrnr closed 6 years ago

tofrnr commented 6 years ago

how is it possible to have 2 BME280 by bus addresses 0x76 and 0x77 simultaneously side by side on same i2c Bus? For that purpose the ability to create instances by passing the bus address would be helpful and then wiring CS to GND or Vc accordingly:

#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

Adafruit_BME280 bme1(0x76);  
Adafruit_BME280 bme2(0x77);  

will that be provided?

ladyada commented 6 years ago

addresses are called in to begin() https://github.com/adafruit/Adafruit_BME280_Library/blob/master/Adafruit_BME280.cpp#L50

tofrnr commented 6 years ago

yes, but as stated: I need 2 addresses (0x76 and 0x77), simultaneously, for 2 devices! So how to have 2 arbitrary instances simultaneously?

tofrnr commented 6 years ago

why do you close this issue? it is not solved - how shall I call begin() with 2 different device addresses??

andrei-ivanov commented 6 years ago

Probably because it's not a library issue, but a general coding issue :-)

tofrnr commented 6 years ago

so what is the solution - I don't see a chance to pass an address to begin() by value, resp. 2 different ones. As long as it is not possible eventually, then it's a library issue.

andrei-ivanov commented 6 years ago

You were given a link to the method that allows to do that. If you don't know how to invoke it, please try a coding guide.

tofrnr commented 6 years ago

I don't understand - in the link there is just the lib source code, what am I expected to do with that? I want to use the lib, with 2 different addresses for 2 different instances simulaneously, so what to do? If possible, show me, if not, it's a lib issue and the lib has to be improved.

andrei-ivanov commented 6 years ago

It's possible, just use Google

ladyada commented 6 years ago

hiya, the library should work - closing this issue because there's a way to do it just not at instantiation :) please only open issues for bugs, not tech support - please contact the company you bought the sensor from for tech support (adafruit has a forum for our customers)