Update main.cpp

This commit is contained in:
Alexandre B 2024-07-07 15:10:37 -04:00
parent 70ca4683be
commit cce4cba967

View File

@ -4,7 +4,6 @@
#include <WiFiClientSecure.h> #include <WiFiClientSecure.h>
//#define BMP280 //#define BMP280
#define BME280 #define BME280
#ifdef BME280 #ifdef BME280
@ -12,7 +11,8 @@
#endif #endif
#ifdef BMP280 #ifdef BMP280
#include <Adafruit_BMP280.h> //#include <Adafruit_BMP280.h>
#include <Adafruit_BME280.h>
#endif #endif
struct { struct {
@ -55,8 +55,9 @@ void setup() {
} }
#endif #endif
#ifdef BMP280 #ifdef BMP280
Adafruit_BMP280 bmp; //Adafruit_BMP280 bmp;
unsigned status = bmp.begin(); Adafruit_BME280 bmp;
unsigned status = bmp.begin(0x58);
if (!status) { if (!status) {
Serial.println("Could not find a valid BME/BMP280 sensor, check wiring!"); Serial.println("Could not find a valid BME/BMP280 sensor, check wiring!");
Serial.print("SensorID was: 0x"); Serial.println(bmp.sensorID(), 16); Serial.print("SensorID was: 0x"); Serial.println(bmp.sensorID(), 16);
@ -66,7 +67,10 @@ void setup() {
Serial.print(" ID of 0x61 represents a BME 680.\n"); Serial.print(" ID of 0x61 represents a BME 680.\n");
while (1) delay(10); while (1) delay(10);
} }
else {} else {
sensors_values.pressure = bmp.readPressure() / 100.0F;
sensors_values.temperature = bmp.readTemperature();
}
#endif #endif
} }