In arduino I have version 2.7.4 of esp8266 installed. I have installed the "Adafruit_CCS811.h" library and I am trying to run the example called "CCS811_test":
#include "Adafruit_CCS811.h"
Adafruit_CCS811 ccs;
void setup() {
Serial.begin(9600);
Serial.println("CCS811 test");
if(!ccs.begin()){
Serial.println("Failed to start sensor! Please check your wiring.");
while(1);
}
// Wait for the sensor to be ready
while(!ccs.available());
}
void loop() {
if(ccs.available()){
if(!ccs.readData()){
Serial.print("CO2: ");
Serial.print(ccs.geteCO2());
Serial.print("ppm, TVOC: ");
Serial.println(ccs.getTVOC());
}
else{
Serial.println("ERROR!");
while(1);
}
}
delay(500);
}
The problem is that when I open the Serial Monitor, I get
Failed to start sensor! Please check your wiring.
I think the connection is well made, so I don't know what that error might be due to.