   char rspc[3]; itoa(flame, rspc, 10); \
   CONTENT(COAP_CONTENTTYPE_TEXT_PLAIN, rspc); \
 }) \
-ROUTE(light, COAP_METHOD_GET, URL("light"), ";if=\"sensor\"", { \
-  char rspc[5]; itoa(light, rspc, 10); \
+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\"", { \


void readAnalogSensors() {
  flame = analogRead(FLAME_PIN);
  light = analogRead(LIGHT_PIN);
}

void writeAnalogOutputs() {
  analogWrite(BUZZER_PIN, 0);
  if (flame > FLAME_ALERT_THRESHOLD)
    beep();
}

void beep() {

#define BUZZER_PIN  5
#define BUZZER_HIGH 30

//// Data Memory ////

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) {
  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("EthErr"));
  if (!ether.dhcpSetup())
    Serial.println(F("DHCPErr"));
  else
    ether.printIp("My IP: ", ether.myip);
  coap_ethercard_begin();
  coap_ethercard_begin_multicast();
}

void loop(void) {
  timer = millis();
