 #define BUZZER_PIN  5
 #define BUZZER_HIGH 30
 
-//// LCD Config ////
-
-#include <PCD8544_SPI.h>
-
-PCD8544_SPI lcd;
-
 //// Data Memory ////
 
-static uint8_t temp;
-static uint8_t humidity;
-static uint8_t flame;
-static uint16_t light;
-static float pressure;
+static uint8_t  temp;
+static uint8_t  humidity;
+static uint8_t  flame;
+static uint8_t  mq2_gas;
+static bool     motion;
+static float    pressure;
+
+static uint32_t timer;
+static uint32_t last_alert_time;
 
 //// Setup & Loop ////
 
 void setup(void) {
-  lcd.begin(false, 0xBD, 0x04, 0x13);
+  last_alert_time = millis() + 20 * 1000; // Wait for the MQ2 to stabilize, do not beep
   bmp.begin();
   dht.begin();
   if (ether.begin(sizeof Ethernet::buffer, mymac, 4) == 0)
-    Serial.println(F("Eth"));
+    Serial.println(F("EthErr"));
   if (!ether.dhcpSetup())
-    Serial.println(F("DHCP"));
+    Serial.println(F("DHCPErr"));
+  else
+    ether.printIp("My IP: ", ether.myip);
   coap_ethercard_begin();
+  coap_ethercard_begin_multicast();
 }
-
-static uint32_t timer;
 
 void loop(void) {
   timer = millis();


//// 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);


  char rspc[3]; itoa(flame, rspc, 10); \
  CONTENT(COAP_CONTENTTYPE_TEXT_PLAIN, rspc); \
}) \
ROUTE(gas, COAP_METHOD_GET, URL("gas"), ";if=\"sensor\"", { \
  char rspc[5]; itoa(mq2_gas, rspc, 10); \
  CONTENT(COAP_CONTENTTYPE_TEXT_PLAIN, rspc); \
}) \
ROUTE(motion, COAP_METHOD_GET, URL("motion"), ";if=\"sensor\"", { \
  char rspc[2];  itoa(motion, rspc, 10); \
  CONTENT(COAP_CONTENTTYPE_TEXT_PLAIN, rspc); \
}) \
ROUTE(buzzer, COAP_METHOD_POST, URL("buzzer"), ";if=\"alarm\"", { \
