From 466d15a9f423265badc287eec18d7949271c8009 Mon Sep 17 00:00:00 2001 From: smash Date: Thu, 12 Nov 2020 19:46:23 +0100 Subject: [PATCH] angepasst fuer led ring, groesserer font, grenzwerte angepasst, messinterval auf 60s geaendert --- src/ebk_co2ampel.cpp | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/src/ebk_co2ampel.cpp b/src/ebk_co2ampel.cpp index 6e18ef8..87e38e9 100644 --- a/src/ebk_co2ampel.cpp +++ b/src/ebk_co2ampel.cpp @@ -5,10 +5,10 @@ // Maximum CO² levels for green and yellow, everything above is considered red. #define GREEN_CO2 800 -#define YELLOW_CO2 1500 +#define YELLOW_CO2 1000 // Measurement interval in miliseconds -#define INTERVAL 10000 +#define INTERVAL 60000 // Pins for MH-Z19 #define RX_PIN 16 @@ -21,10 +21,13 @@ // Pin for LED #define LED_PIN 4 +// number of LEDs connected +#define NUMPIXELS 12 + MHZ19 myMHZ19; HardwareSerial mySerial(1); SSD1306Wire display(0x3c, SDA_PIN, SCL_PIN); -Adafruit_NeoPixel pixels = Adafruit_NeoPixel(1, LED_PIN, NEO_RGB + NEO_KHZ400); +Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, LED_PIN, NEO_RGB + NEO_KHZ400); unsigned long getDataTimer = 0; int lastvals[120]; @@ -34,19 +37,24 @@ void setup() { Serial.begin(9600); mySerial.begin(9600, SERIAL_8N1, RX_PIN, TX_PIN); myMHZ19.begin(mySerial); + pixels.clear(); display.init(); display.setContrast(255); delay(1000); display.clear(); + display.flipScreenVertically(); dheight = display.getHeight(); myMHZ19.autoCalibration(); // Fill array of last measurements with -1 for (int x = 0; x <= 119; x = x + 1) { lastvals[x] = -1; } + pixels.begin(); - pixels.setPixelColor(0, 30,0,0); - pixels.show(); + for(int i=0; i