Hello All!
I am trying to use the SparkFun Indoor Air Quality Sensor - ENS160 (Qwiic) with Arduino and after uploading the following code:
*/
#include <SPI.h>
#include “SparkFun_ENS160.h”
SparkFun_ENS160_SPI myENS;
// Adjust pin select to suit your project’s needs.
int chipSelect = 0;
int ensStatus = 0;
void setup()
{
pinMode(chipSelect, OUTPUT);
digitalWrite(chipSelect, HIGH);
SPI.begin();
Serial.begin(115200);
if( !myENS.begin(chipSelect) )
{
Serial.println(“Did not begin.”);
while(1);
}
// Reset the indoor air quality sensor’s settings.
if( myENS.setOperatingMode(SFE_ENS160_RESET) )
Serial.println(“Ready.”);
delay(100);
// Device needs to be set to idle to apply any settings.
// myENS.setOperatingMode(SFE_ENS160_IDLE);
// Set to standard operation
// Others include SFE_ENS160_DEEP_SLEEP and SFE_ENS160_IDLE
myENS.setOperatingMode(SFE_ENS160_STANDARD);
Serial.print("Operating Mode: ");
Serial.println(myENS.getOperatingMode());
// There are four values here:
// 0 - Operating ok: Standard Opepration
// 1 - Warm-up: occurs for 3 minutes after power-on.
// 2 - Initial Start-up: Occurs for the first hour of operation.
// and only once in sensor’s lifetime.
// 3 - No Valid Output
ensStatus = myENS.getFlags();
Serial.print("Gas Sensor Status Flag: ");
Serial.println(ensStatus);
}
void loop()
{
if( myENS.checkDataStatus() )
{
Serial.print("Air Quality Index (1-5) : ");
Serial.println(myENS.getAQI());
Serial.print("Total Volatile Organic Compounds: ");
Serial.print(myENS.getTVOC());
Serial.println(“ppb”);
Serial.print("CO2 concentration: ");
Serial.print(myENS.getECO2());
Serial.println(“ppm”);
}
delay(200);
}
All I am getting is “Did not begin” on the serial monitor after 20 seconds into power up.
What am I doing wrong here?
Thanks for your time!