From 5ece74b0e659607330be1786bc0bfb41df9270ae Mon Sep 17 00:00:00 2001 From: Ollo Date: Sun, 12 Dec 2021 17:07:20 +0100 Subject: [PATCH] Activate I2C after powering the sensor --- src/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 4075751..c8ab44e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -403,8 +403,6 @@ void setup() .setDatatype("integer"); strip.begin(); - /* activate I2C for BOSCH sensor */ - Wire.begin(SENSOR_I2C_SDI, SENSOR_I2C_SCK); mConfigured = Homie.isConfigured(); digitalWrite(WITTY_RGB_G, HIGH); @@ -415,6 +413,10 @@ void setup() printf("Wait 1 second...\r\n"); delay(1000); #endif + /* activate I2C for BOSCH sensor */ + Wire.begin(SENSOR_I2C_SDI, SENSOR_I2C_SCK); + printf("Wait 50 milliseconds...\r\n"); + delay(50); /* Extracted from library's example */ mFailedI2Cinitialization = !bmx.begin(); if (!mFailedI2Cinitialization) {