Closed dsn-github closed 3 years ago
hi, it isnt clear why this is needed? please explain it :)
On 27.02.2020 01:51, ladyada wrote:
hi, it isnt clear why this is needed? please explain it :)
Hi.
Yes, I saw that setSampling method wrote to ctrl_hum register.
But in this case this doesn't work, humidity measurement remains disabled:
Adafruit_BME280 bme;
void setup() {
bme.begin(0x76);
bme.setSampling(Adafruit_BME280::MODE_FORCED, Adafruit_BME280::SAMPLING_X1, Adafruit_BME280::SAMPLING_X1, Adafruit_BME280::SAMPLING_X1, Adafruit_BME280::FILTER_OFF );
// ...
}
void loop() { float t, h;
bme.takeForcedMeasurement();
t = bme.readTemperature();
h = bme.readHumidity(); // get nan
// ...
}
@caternuson lgtm can you check me ? :)
I can't recreate the issue. I added some serial output to the example above:
#include <Adafruit_BME280.h>
Adafruit_BME280 bme;
void setup() {
Serial.begin(9600);
bme.begin();
bme.setSampling(Adafruit_BME280::MODE_FORCED,
Adafruit_BME280::SAMPLING_X1,
Adafruit_BME280::SAMPLING_X1,
Adafruit_BME280::SAMPLING_X1,
Adafruit_BME280::FILTER_OFF );
}
void loop() {
float t, h;
bme.takeForcedMeasurement();
t = bme.readTemperature();
h = bme.readHumidity(); // get nan
Serial.print("t = "); Serial.print(t);
Serial.print(" h = "); Serial.println(h);
delay(500);
}
and it runs OK using the current version of the library:
I think as long as osrs_h
is non-zero, the humidity measurement occurs.
And there's no need to re-write to the humidity control register.
@dsn-github Is this still an issue for you? If you run the same code I tested above, what do you get?
Closing due to lack of activity. Original issue could not be recreated.
For whatever reasons I get Humidity = nan %
according to the lib it's because read16(BME280_REGISTER_HUMIDDATA);
return 0x8000
.
Other readings are fine:
Temperature = 19.83 °C
Pressure = 932.42 hPa
really weird...
@SebDominguez Please open a new issue.
takeForcedMeasurement(): write to ctrl_hum register to properly set up humidity measurement