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.
Diff: main.cpp
- Revision:
- 11:769f2b28b236
- Parent:
- 10:c8a6f2822068
- Child:
- 12:e622e146b3cd
--- a/main.cpp Tue Sep 18 15:20:28 2012 +0000 +++ b/main.cpp Wed Sep 19 09:36:57 2012 +0000 @@ -44,7 +44,7 @@ DigitalOut led3(LED3); // LED 3 is use to indicate if the relay is being switched on to open the door DigitalOut led4(LED4); DigitalOut doorContactorRelay(p5); // create a digital pin object to control the door contactor relay -DigitalIn doorProximitySwitch(p6); // create a digital pin object to sense door position proximity switch, this works in reverse +DigitalIn doorProximitySwitch(p6); // create a digital pin object to sense door position proximity switch, this works in reverse // the switch senses positive when the door is closed - need to be sure when it's closed! :-) bool openTheDoor = false; // create a state variable which is set to indicate the mbed should open the door // this variable will be used hold the latch open until it knows the door has been open. @@ -168,7 +168,7 @@ t.attach(tick,1); DBG_INIT(); - Thread testTask(test, NULL, osPriorityNormal, 1024*4); + Thread testTask(test, NULL, osPriorityNormal, 1024*6); // keepAlive(NULL);