forked from airgradienthq/arduino
-Changed getCO2 to return a char and if sensor is non existent will return NULL -Changed getPM2 to return a char and if sensor is non existent will return NULL -Added a new function getPM2_Raw which will return the value of PM2 as an integer -Added a new function getCO2_Raw which will return the value of CO2 as an integer -Added 2 new variables in the TMP_Raw Struct: 1. t_Char 2. rh_Char These variables will be used to store the corresponding values as char and if sensor is nonexistent should be NULL
27 lines
487 B
Arduino
27 lines
487 B
Arduino
#include <AirGradient.h>
|
|
AirGradient ag = AirGradient();
|
|
|
|
void setup(){
|
|
Serial.begin(9600);
|
|
ag.PMS_Init();
|
|
ag.CO2_Init();
|
|
ag.TMP_RH_Init(0x44); //check for SHT sensor with address 0x44
|
|
}
|
|
|
|
void loop(){
|
|
|
|
Serial.print("PM2: ");
|
|
Serial.println(ag.getPM2());
|
|
|
|
|
|
Serial.print("CO2: ");
|
|
Serial.println(ag.getCO2());
|
|
|
|
TMP_RH result = ag.periodicFetchData();
|
|
Serial.print("Humidity: ");
|
|
Serial.print(result.rh);
|
|
Serial.print(" Temperature: ");
|
|
Serial.println(result.t);
|
|
delay(5000);
|
|
}
|