   }
   
 }
+
+/** 
+ * raises an alarm
+ */
+class Alarm {
+  unsigned long PrevMillis;
+  unsigned long DurationOn; // in millis
+  unsigned long DurationOff; // in millis
+  bool state;
+  uint8_t pin;
+
+public:
+  Alarm(unsigned long dOn, unsigned long dOff, uint8_t p) {
+    DurationOn = dOn;
+    DurationOff = dOff;
+    pin = p;
+    state = LOW;
+  }
+
+  Alarm() { // default
+    DurationOn = 1000; // 1 second
+    DurationOff = 1000; // 1 second
+    pin = RELAY1;
+    state = LOW;
+  }
+
+  void PoundTheAlarm() { // shameless Nicki Minaj reference
+    if (!state && (millis() - PrevMillis) > DurationOff) {
+    Serial.print("PTA!");
+      // turn it on
+      digitalWrite(pin, HIGH);
+      state = HIGH;
+      PrevMillis = millis();
+    } else if (state && (millis() - PrevMillis) > DurationOn) {
+      // turn it off
+      digitalWrite(pin, LOW);
+      state = LOW;
+      PrevMillis = millis();
+    }
+  }
+};
 
 /**
  * updates LCD

  // put your main code here, to run repeatedly:
  now = rtc.now();
  DU.update(lcd, rtc, cc3000);
 
}

void setup() {
  // serial debug connection
  Serial.begin(115200);
  // I/O
  pinMode(RELAY1, OUTPUT);
  pinMode(RELAY2, OUTPUT);
  pinMode(RELAY4, OUTPUT);
  // put your setup code here, to run once:
  Serial.println(F("\nInitialising the LCD ..."));
  lcd.begin(20,4);
