Code bug for Sparkfun Environmental Combo CCS811/BME280 with Arduino

I got the bug with Compilation error: variable or field ‘printDriverError’ declared void.

Here is the code:

/*

Read both CCS811 and BME280 sensors at same time

By: Nathan Seidle

SparkFun Electronics

Date: April 6th, 2017

License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).

Works with SparkFun combo board https://www.sparkfun.com/products/14241

Enjoy this code? Buy a board and help support SparkFun!

Let’s read both sensors at the same time!

Outputs CO2, TVOC, temperature, humidty, and pressure.

Hardware Connections (Breakoutboard to Arduino):

Attach a Qwiic Shield to your RedBoard, Photon, or ESP32.

Plug the Qwiic Air Quality Combo board into one of the connectors

Serial.print it out at 9600 baud to serial monitor.

*/

#include <Wire.h>

#include “SparkFunBME280.h” //Library for BME280 from library manager or https://github.com/sparkfun/SparkFun_BM … no_Library

#include “SparkFunCCS811.h”

#define CCS811_ADDR 0x5B

CCS811 myCCS811(CCS811_ADDR);

BME280 myBME280; //Global sensor object for BME280

//Global variables obtained from the two sensors

unsigned int tVOC = 0;

unsigned int CO2 = 0;

float tempf = 0;

float humidity = 0;

float pressureInHg = 0;

void setup()

{

Serial.begin(9600);

Serial.println(“CCS811+BME280 Read Example”);

Wire.begin();//initialize I2C bus

CCS811Core::status returnCode = myCCS811.begin();

if (returnCode != CCS811Core::SENSOR_SUCCESS)

{

Serial.println(“Problem with CCS811”);

printDriverError(returnCode);

}

else

{

Serial.println(“CCS811 online”);

}

//Setup the BME280 for basic readings

myBME280.settings.commInterface = I2C_MODE;

myBME280.settings.I2CAddress = 0x77;

myBME280.settings.runMode = 3; // 3, Normal mode

myBME280.settings.tStandby = 0; // 0, 0.5ms

myBME280.settings.filter = 0; // 0, filter off

myBME280.settings.tempOverSample = 1;

myBME280.settings.pressOverSample = 1;

myBME280.settings.humidOverSample = 1;

delay(10); //Give BME280 time to come on

//Calling .begin() causes the settings to be loaded

byte id = myBME280.begin(); //Returns ID of 0x60 if successful

if (id != 0x60)

{

Serial.println(“Problem with BME280”);

}

else

{

Serial.println(“BME280 online”);

}

}

void loop()

{

if (myCCS811.dataAvailable()) //Check to see if CCS811 has new data (it’s the slowest sensor)

{

myCCS811.readAlgorithmResults(); //Read latest from CCS811 and update tVOC and CO2 variables

//getWeather(); //Get latest humidity/pressure/temp data from BME280

printData(); //Pretty print all the data

}

else if (myCCS811.checkForStatusError()) //Check to see if CCS811 has thrown an error

{

Serial.println(myCCS811.getErrorRegister()); //Prints whatever CSS811 error flags are detected

}

delay(2000); //Wait for next reading

}

//Print CO2, TVOC, Humidity, Pressure and Temp

void printData()

{

Serial.print(" CO2[");

Serial.print(myCCS811.getCO2());

Serial.print(“]ppm”);

Serial.print(" TVOC[");

Serial.print(myCCS811.getTVOC());

Serial.print(“]ppb”);

Serial.print(" temp[");

Serial.print(myBME280.readTempC(), 1);

Serial.print(“]C”);

//Serial.print(" temp[");

//Serial.print(myBME280.readTempF(), 1);

//Serial.print(“]F”);

Serial.print(" pressure[");

Serial.print(myBME280.readFloatPressure(), 2);

Serial.print(“]Pa”);

//Serial.print(" pressure[");

//Serial.print((myBME280.readFloatPressure() * 0.0002953), 2);

//Serial.print(“]InHg”);

//Serial.print(“altitude[”);

//Serial.print(myBME280.readFloatAltitudeMeters(), 2);

//Serial.print(“]m”);

//Serial.print(“altitude[”);

//Serial.print(myBME280.readFloatAltitudeFeet(), 2);

//Serial.print(“]ft”);

Serial.print(" humidity[");

Serial.print(myBME280.readFloatHumidity(), 0);

Serial.print(“]%”);

Serial.println();

}

void printDriverError( CCS811Core::status errorCode )

{

switch ( errorCode )

{

case CCS811Core::SENSOR_SUCCESS:

Serial.print(“SUCCESS”);

break;

case CCS811Core::SENSOR_ID_ERROR:

Serial.print(“ID_ERROR”);

break;

case CCS811Core::SENSOR_I2C_ERROR:

Serial.print(“I2C_ERROR”);

break;

case CCS811Core::SENSOR_INTERNAL_ERROR:

Serial.print(“INTERNAL_ERROR”);

break;

case CCS811Core::SENSOR_GENERIC_ERROR:

Serial.print(“GENERIC_ERROR”);

break;

default:

Serial.print(“Unspecified error.”);

}

}

Try replacing the ‘CCS811Core::status’ with ‘CCS811Core::CCS811_Status_e’ ? https://forum.arduino.cc/t/sparkfun-ccs … ng/1029143 That was the advice here

You can also create an ‘issue’ here if that does fix the code, which will alert the engineers of the problem https://github.com/sparkfun/Qwiic_BME28 … mbo/issues

TS-Russell:
Try replacing the ‘CCS811Core::status’ with ‘CCS811Core::CCS811_Status_e’ ? https://forum.arduino.cc/t/sparkfun-ccs … g/1029143/[AARPMedicare That was the advice here

You can also create an ‘issue’ here if that does fix the code, which will alert the engineers of the problem https://github.com/sparkfun/Qwiic_BME28 … mbo/issues
[/quote]

Thanks for sharing this link it’s very helpful for me. Every time i got query sparkfun.com give me my solution.

Best regard,](https://www.myaarpmedicares.us/)