Door controller and proximity switch detection.

Dependencies:   mbed-rtos mbed VodafoneUSBModem_bleedingedge

This program takes in a digital input - which is a reed switch for a door - and an output to a relay. The door is open with a simple 'text' to the modem on the USB bus (i used k3770 vodafone dongle).

The door will send an alarm message to your nominated numbers at the start of the program if the door is open without a command being sent.

Very simple - and just meant as a demonstration of how to incorporate GSM/3G functionality to a evice.

Revision:
3:0a8eebcb0acf
Parent:
2:bcc9256ecaab
Child:
4:99bbdfe42ae0
--- a/main.cpp	Tue May 15 16:19:09 2012 +0000
+++ b/main.cpp	Tue May 15 16:23:57 2012 +0000
@@ -45,6 +45,8 @@
 DigitalOut led2(LED2);
 DigitalOut led3(LED3);
 DigitalOut led4(LED4);
+DigitalOut doorOpen(p5);
+
 
 void test(void const*) {
   VodafoneK3770 threeg;
@@ -58,6 +60,12 @@
     char num[17];
     char msg[64];
     size_t count;
+    if (doorOpen)
+    {
+        doorOpen = 0;
+        LED3=0;
+    
+    }
     int ret = threeg.getSMCount(&count);
     if(ret)
     {
@@ -81,6 +89,8 @@
       {
         DBG("The SMS message indicates I should open the door");
         // do something to open the door
+        doorOpen = 1;
+        LED3 = 1
       }
       else
       {