diff --git a/envisens/atmega_fw/atmega_fw.ino b/envisens/atmega_fw/atmega_fw.ino index 289b35e..fcb4efb 100644 --- a/envisens/atmega_fw/atmega_fw.ino +++ b/envisens/atmega_fw/atmega_fw.ino @@ -20,6 +20,10 @@ DHT dht(DHT_PIN, DHT_TYPE); int sensorValue; long last_sample = 0; +float hmid = 0; // humidity +float temp = 0; // temperature +float heat = 0; // heat index +float airq = 0; // air quality / gas void setup() { Serial.begin(SERIAL_BAUDRATE); @@ -38,25 +42,25 @@ void loop() { last_sample = now; if (OPERATION_BLINK_EN) {digitalWrite(LED_BUILTIN, HIGH);} - float h = dht.readHumidity(); - float t = dht.readTemperature(); + hmid = dht.readHumidity(); + temp = dht.readTemperature(); - if (isnan(h) || isnan(t)) { + if (isnan(hmid) || isnan(temp)) { Serial.println(F("Failed to read from DHT sensor!")); } else { - float hi = dht.computeHeatIndex(t, h, false); + heat = dht.computeHeatIndex(temp, hmid, false); Serial.print(F("Humidity: ")); - Serial.print(h); + Serial.print(hmid); Serial.print(F("% Temperature: ")); - Serial.print(t); + Serial.print(temp); Serial.print(F("°C Heat index: ")); - Serial.print(hi); - Serial.println(F("°C ")); + Serial.print(heat); + Serial.print(F("°C ")); } - sensorValue = analogRead(MQ135_PIN); - Serial.print("AirQuality="); - Serial.print(sensorValue, DEC); + airq = analogRead(MQ135_PIN); + Serial.print("AirQuality: "); + Serial.print(airq); Serial.println(" PPM"); } }