CO2 error handling in library

Small improvements in examples
This commit is contained in:
Achim
2022-10-29 07:39:11 +07:00
parent d5c8af68a0
commit 90eee5d17f
10 changed files with 108 additions and 50 deletions

View File

@ -24,7 +24,7 @@ MIT License
AirGradient ag = AirGradient();
void setup(){
Serial.begin(9600);
Serial.begin(115200);
ag.CO2_Init();
}

View File

@ -55,7 +55,7 @@ Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(8, 8, PIN,
NEO_GRB + NEO_KHZ800);
void setup() {
Serial.begin(9600);
Serial.begin(115200);
ag.CO2_Init();
matrix.begin();
matrix.setRotation(1); // change rotation

View File

@ -9,7 +9,7 @@ Kits (including a pre-soldered version) are available: https://www.airgradient.c
The codes needs the following libraries installed:
“WifiManager by tzapu, tablatronix” tested with version 2.0.11-beta
“U8g2” by oliver tested with version 2.32.15
"ESP8266 and ESP32 OLED driver for SSD1306 displays by ThingPulse, Fabrice Weinberg" tested with Version 4.1.0
Configuration:
Please set in the code below the configuration parameters.

View File

@ -53,7 +53,7 @@ boolean connectWIFI=true;
String APIROOT = "http://hw.airgradient.com/";
void setup(){
Serial.begin(9600);
Serial.begin(115200);
display.init();
display.flipScreenVertically();

View File

@ -36,7 +36,7 @@ MIT License
#include <U8g2lib.h>
AirGradient ag = AirGradient();
DFRobot_SGP40 mySgp40;
DFRobot_SGP40 sgp40;
// Display bottom right
U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
@ -96,12 +96,7 @@ void setup()
}
updateOLED2("Warming up the", "sensors.", "");
while(mySgp40.begin(/*duration = */10000) !=true){
Serial.println("failed to init chip, please check if the chip connection is fine");
delay(1000);
}
sgp40.begin();
ag.CO2_Init();
ag.PMS_Init();
ag.TMP_RH_Init(0x44);
@ -123,7 +118,7 @@ void updateTVOC()
{
if (currentMillis - previousTVOC >= tvocInterval) {
previousTVOC += tvocInterval;
TVOC = mySgp40.getVoclndex();
TVOC = sgp40.getVoclndex();
Serial.println(String(TVOC));
}
}
@ -148,7 +143,6 @@ void updatePm25()
void updateTempHum()
{
if (currentMillis - previousTempHum >= tempHumInterval) {
previousTempHum += tempHumInterval;
TMP_RH result = ag.periodicFetchData();
@ -230,8 +224,8 @@ void sendToServer() {
WiFiManagerParameter custom_text("<p>This is just a text paragraph</p>");
wifiManager.addParameter(&custom_text);
WiFiManagerParameter parameter("parameterId", "Parameter Label", "default value", 40);
wifiManager.addParameter(&parameter);
WiFiManagerParameter parameter("parameterId", "Parameter Label", "default value", 40);
wifiManager.addParameter(&parameter);
Serial.println("Parameter 1:");

View File

@ -25,7 +25,7 @@ MIT License
AirGradient ag = AirGradient();
void setup() {
Serial.begin(9600);
Serial.begin(115200);
ag.PMS_Init();
}

View File

@ -24,7 +24,7 @@ MIT License
AirGradient ag = AirGradient();
void setup(){
Serial.begin(9600);
Serial.begin(115200);
ag.TMP_RH_Init(0x44); //check for SHT sensor with address 0x44
}