Skip to content

Commit 82b11d8

Browse files
committed
Fix for issue 6
1 parent 6318507 commit 82b11d8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/SparkFunCCS811.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,13 @@ CCS811Core::status CCS811::begin( void )
296296
return SENSOR_I2C_ERROR;
297297
}
298298

299+
//Added from issue 6
300+
// Without a delay here, the CCS811 and I2C can be put in a bad state.
301+
// Seems to work with 50us delay, but make a bit longer to be sure.
302+
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
303+
delayMicroseconds(100);
304+
#endif
305+
299306
returnError = setDriveMode(1); //Read every second
300307

301308
return returnError;

0 commit comments

Comments
 (0)