This commit is contained in:
Alexander 2024-07-07 14:20:23 -04:00
parent 8326aaf28e
commit 396444c3da
2 changed files with 20 additions and 6 deletions

View File

@ -12,7 +12,7 @@
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 9600
monitor_speed = 115200
lib_deps =
adafruit/Adafruit BME280 Library@^2.2.2
adafruit/Adafruit BMP280 Library@^2.6.8

View File

@ -4,10 +4,7 @@
#include <Adafruit_BMP280.h>
#include <WiFiClientSecure.h>
#define BME280
//#define BME280
struct {
float humidity = 0.0;
@ -17,13 +14,30 @@ struct {
void setup() {
Serial.begin(9600);
Serial.begin(115200);
Serial.println();
Serial.println("Running setup ...");
sensors_values.humidity = 0.0;
sensors_values.pressure = 0.0;
sensors_values.temperature = 0.0;
byte error, address;
int dev = 0;
for (address = 1; address < 127; address++) {
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0) {
Serial.print("I2C device found at address 0x");
Serial.println(address, HEX);
dev++;
}
else if (error == 4) {
Serial.println("Unknown error at address 0x");
Serial.println(address, HEX);
}
delay(250);
}
#ifdef BME280
Adafruit_BME280 bme;
unsigned status = bme.begin(0x76); // I2C slave address 0x76 (SDO set to GND)