 
 void readAnalogSensors() {
   flame = analogRead(FLAME_PIN);
-  light = analogRead(LIGHT_PIN);
+  mq2_gas = analogRead(MQ2_PIN);
 }
 
 void writeAnalogOutputs() {
   analogWrite(BUZZER_PIN, 0);
-  if (flame > FLAME_ALERT_THRESHOLD)
+  if ((flame > FLAME_ALERT_THRESHOLD || mq2_gas > MQ2_ALERT_THRESHOLD)
+      && millis() - last_alert_time > 1000) {
     beep();
+    last_alert_time = millis();
+  }
 }
 
 void beep() {


//// Sensor Config ////

#define FLAME_PIN             0
#define FLAME_ALERT_THRESHOLD 190
#define LIGHT_PIN             1

#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>
#include <DHT.h>
#include <DHT_U.h>

#define DHT_PIN  0
#define DHT_TYPE DHT11
DHT_Unified dht(DHT_PIN, DHT_TYPE);


  }
  if (timer % 2000 == 0) {
    readDigitalSensors();
  }
  delay(50);
}

void readDigitalSensors() {
  motion = digitalRead(PIR_PIN) == HIGH;
  
  sensors_event_t event;

  dht.temperature().getEvent(&event);
  temp = event.temperature;
  if (isnan(event.temperature))
    Serial.println(F("TempErr"));

  dht.humidity().getEvent(&event);
  humidity = event.relative_humidity;
  if (isnan(event.relative_humidity))
    Serial.println(F("HumidErr"));

  bmp.getEvent(&event);
  pressure = event.pressure * 0.75; // hPa -> mmHg
