mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-29 16:37:17 +02:00
CO2 error handling in library
Small improvements in examples
This commit is contained in:
@ -24,7 +24,7 @@ MIT License
|
||||
AirGradient ag = AirGradient();
|
||||
|
||||
void setup(){
|
||||
Serial.begin(9600);
|
||||
Serial.begin(115200);
|
||||
ag.CO2_Init();
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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();
|
||||
|
@ -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(¶meter);
|
||||
WiFiManagerParameter parameter("parameterId", "Parameter Label", "default value", 40);
|
||||
wifiManager.addParameter(¶meter);
|
||||
|
||||
|
||||
Serial.println("Parameter 1:");
|
||||
|
@ -25,7 +25,7 @@ MIT License
|
||||
AirGradient ag = AirGradient();
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
Serial.begin(115200);
|
||||
ag.PMS_Init();
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user