Browse Source

retry bme

main
Hendrik Langer 7 years ago
parent
commit
4689354964
  1. 4
      src/BME280.cpp

4
src/BME280.cpp

@ -15,11 +15,15 @@ bool BME280::begin(void) {
digitalWrite(23, HIGH); // enable bme280 CS digitalWrite(23, HIGH); // enable bme280 CS
delay(50); delay(50);
bme = new Adafruit_BME280(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI bme = new Adafruit_BME280(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI
int retries = 0;
while (!(status = bme->begin())) { while (!(status = bme->begin())) {
if (retries > 5) break;
retries++;
Serial.println("Could not find a valid BME280 sensor, check wiring!"); Serial.println("Could not find a valid BME280 sensor, check wiring!");
// bme->reset(); // bme->reset();
delay(500); delay(500);
} }
if (!status) return false;
return true; return true;
} }

Loading…
Cancel
Save