From 063e800be2a6de31fe0f8c8e649049585e841a9a Mon Sep 17 00:00:00 2001 From: Alexandre B Date: Sun, 17 Dec 2023 13:58:09 -0500 Subject: [PATCH] temp sensor --- ESP32_Temperture-Node/platformio.ini | 2 ++ ESP32_Temperture-Node/src/config.h | 2 +- ESP32_Temperture-Node/src/main.cpp | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ESP32_Temperture-Node/platformio.ini b/ESP32_Temperture-Node/platformio.ini index 7543edcfd..54badcbba 100644 --- a/ESP32_Temperture-Node/platformio.ini +++ b/ESP32_Temperture-Node/platformio.ini @@ -15,6 +15,8 @@ framework = arduino monitor_speed = 115200 lib_deps = knolleary/PubSubClient@^2.8 + adafruit/Adafruit BME280 Library@^2.2.2 + adafruit/Adafruit BMP280 Library@^2.6.6 [platformio] description = ESP32 Sensors node diff --git a/ESP32_Temperture-Node/src/config.h b/ESP32_Temperture-Node/src/config.h index 1f5ae0a1e..518938a68 100644 --- a/ESP32_Temperture-Node/src/config.h +++ b/ESP32_Temperture-Node/src/config.h @@ -1,7 +1,7 @@ // Uncomment modules as required //#define RTC //#define MICRO_SD -//#define BMP280 // Adafruit BMP280; temp & pressure +#define BMP280 // Adafruit BMP280; temp & pressure //#define BME280 // Generic BME280; temp, pressure & humidity //#define AWSIoT diff --git a/ESP32_Temperture-Node/src/main.cpp b/ESP32_Temperture-Node/src/main.cpp index f3056e6d2..4060ec976 100644 --- a/ESP32_Temperture-Node/src/main.cpp +++ b/ESP32_Temperture-Node/src/main.cpp @@ -17,6 +17,13 @@ #include "secrets.h" #include "config.h" +#ifdef BME280 +#include +#endif +#ifdef BMP280 +#include +#endif + struct { float humidity = 0.0; float pressure = 0.0;