add more parameters on button press

This commit is contained in:
2023-04-09 12:39:57 -07:00
parent 60fcec2a61
commit 75ecfdfa57

46
aqi.ino
View File

@@ -6,6 +6,7 @@
SensirionI2CSen44 sen44;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int buttonPin = 6;
float heatIndex(float t, float rh) {
float hi = 0.0;
@@ -44,6 +45,9 @@ void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// set up the button pin
pinMode(buttonPin, INPUT_PULLUP);
Wire.begin();
uint16_t error;
@@ -104,21 +108,39 @@ void loop() {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("t:");
lcd.print(round(ambientTemperature));
if (digitalRead(buttonPin) == LOW) {
lcd.setCursor(0, 0);
lcd.print("1:");
lcd.print(massConcentrationPm1p0);
lcd.setCursor(8, 0);
lcd.print("h:");
lcd.print(round(ambientHumidity));
lcd.setCursor(8, 0);
lcd.print("2:");
lcd.print(massConcentrationPm2p5);
lcd.setCursor(0, 1);
lcd.print("f:");
lcd.print(round(feelsLikeTemperature));
lcd.setCursor(0, 1);
lcd.print("4:");
lcd.print(massConcentrationPm4p0);
lcd.setCursor(8, 1);
lcd.print("v:");
lcd.print(vocIndex, 0);
lcd.setCursor(8, 1);
lcd.print("10:");
lcd.print(massConcentrationPm10p0);
} else {
lcd.setCursor(0, 0);
lcd.print("t:");
lcd.print(round(ambientTemperature));
lcd.setCursor(8, 0);
lcd.print("h:");
lcd.print(round(ambientHumidity));
lcd.setCursor(0, 1);
lcd.print("f:");
lcd.print(round(feelsLikeTemperature));
lcd.setCursor(8, 1);
lcd.print("v:");
lcd.print(vocIndex, 0);
}
//Serial.println("------------");
//Serial.print("Voc:");