add more parameters on button press
This commit is contained in:
22
aqi.ino
22
aqi.ino
@@ -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,6 +108,23 @@ void loop() {
|
||||
|
||||
lcd.clear();
|
||||
|
||||
if (digitalRead(buttonPin) == LOW) {
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print("1:");
|
||||
lcd.print(massConcentrationPm1p0);
|
||||
|
||||
lcd.setCursor(8, 0);
|
||||
lcd.print("2:");
|
||||
lcd.print(massConcentrationPm2p5);
|
||||
|
||||
lcd.setCursor(0, 1);
|
||||
lcd.print("4:");
|
||||
lcd.print(massConcentrationPm4p0);
|
||||
|
||||
lcd.setCursor(8, 1);
|
||||
lcd.print("10:");
|
||||
lcd.print(massConcentrationPm10p0);
|
||||
} else {
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print("t:");
|
||||
lcd.print(round(ambientTemperature));
|
||||
@@ -119,6 +140,7 @@ void loop() {
|
||||
lcd.setCursor(8, 1);
|
||||
lcd.print("v:");
|
||||
lcd.print(vocIndex, 0);
|
||||
}
|
||||
|
||||
//Serial.println("------------");
|
||||
//Serial.print("Voc:");
|
||||
|
||||
Reference in New Issue
Block a user