From 201f614057ca0ca528c49c6cf021ee3c0dcf62ba Mon Sep 17 00:00:00 2001 From: Alexandre B Date: Sun, 7 Jul 2024 14:35:43 -0400 Subject: [PATCH] Update main.cpp --- ESP32-BME280/src/main.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ESP32-BME280/src/main.cpp b/ESP32-BME280/src/main.cpp index a2bf5b49..23c9b699 100644 --- a/ESP32-BME280/src/main.cpp +++ b/ESP32-BME280/src/main.cpp @@ -1,7 +1,8 @@ #include +#include -#include -#include +//#include +//#include #include //#define BME280 @@ -21,18 +22,21 @@ void setup() { sensors_values.pressure = 0.0; sensors_values.temperature = 0.0; - byte error, address; + byte error; + uint8_t address; int dev = 0; for (address = 0x1; address < 0x127; address++) { + Wire.begin(address); Wire.beginTransmission(address); - error = Wire.endTransmission(); + error = Wire.endTransmission(address); + Wire.end(); 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.print("Unknown error at address 0x"); Serial.println(address, HEX); } delay(500);