From f69efbd224daf126674bf08281527481bbb4fd52 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Mon, 1 Feb 2021 15:24:29 +0100 Subject: [PATCH] [Bugfix] Make BMP180 sensor code work MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The variable name was wrong, and Wire wasn’t initialized when the sensor was enabled. --- WeatherStation.ino | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/WeatherStation.ino b/WeatherStation.ino index 9f12f8b..c8cd5d6 100644 --- a/WeatherStation.ino +++ b/WeatherStation.ino @@ -60,7 +60,7 @@ BH1750 light; #endif // HAVE_BH1750 #ifdef HAVE_BMP180 -Adafruit_BMP085 BMP; +Adafruit_BMP085 bmp; #endif // HAVE_BMP180 #if SYSTEM_MODE & MODE_PROM_PULL @@ -152,9 +152,11 @@ setup() pinMode(RAIN_PIN, INPUT); #endif // RAIN_PIN -#ifdef HAVE_BH1750 +#if defined(HAVE_BMP180) || defined(HAVE_BH1750) Wire.begin(I2C_SDA_PIN, I2C_SCL_PIN); +#endif // HAVE_BMP180 || HAVE_BH1750 +#ifdef HAVE_BH1750 if (!light.begin()) { Serial.println("Could not find the BH1750 sensor!"); stop();