Weather control switch for connected day. NXP LPC 1768 module. Ethernet connectivity.

Dependencies:   EthernetInterface mbed-rtos mbed nanoservice_client_1_12

Fork of Trenton_Switch_LPC1768_WIFLY by Demo Team

Committer:
andcor02
Date:
Wed Dec 03 09:03:29 2014 +0000
Revision:
25:cb16c5248769
ETH CES

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andcor02 25:cb16c5248769 1 /*
andcor02 25:cb16c5248769 2 PIR.cpp - sensor library
andcor02 25:cb16c5248769 3 Developed by Andrea Corrado
andcor02 25:cb16c5248769 4 */
andcor02 25:cb16c5248769 5
andcor02 25:cb16c5248769 6
andcor02 25:cb16c5248769 7 #ifndef MBED_PIR_H
andcor02 25:cb16c5248769 8 #define MBED_PIR_H
andcor02 25:cb16c5248769 9
andcor02 25:cb16c5248769 10 #include "mbed.h"
andcor02 25:cb16c5248769 11
andcor02 25:cb16c5248769 12 /* EXAMPLE
andcor02 25:cb16c5248769 13
andcor02 25:cb16c5248769 14 #include "mbed.h"
andcor02 25:cb16c5248769 15 #include "PIR.h"
andcor02 25:cb16c5248769 16
andcor02 25:cb16c5248769 17 Serial pc (USBTX,USBRX);
andcor02 25:cb16c5248769 18
andcor02 25:cb16c5248769 19 PIR sensor(PTB2);
andcor02 25:cb16c5248769 20
andcor02 25:cb16c5248769 21 int main()
andcor02 25:cb16c5248769 22 {
andcor02 25:cb16c5248769 23
andcor02 25:cb16c5248769 24 if (sensor.getdetection()) {
andcor02 25:cb16c5248769 25 pc.printf("\n\r Detection");
andcor02 25:cb16c5248769 26 sensor.resetdetection();
andcor02 25:cb16c5248769 27 }
andcor02 25:cb16c5248769 28 }
andcor02 25:cb16c5248769 29 */
andcor02 25:cb16c5248769 30
andcor02 25:cb16c5248769 31 class PIR {
andcor02 25:cb16c5248769 32
andcor02 25:cb16c5248769 33 public:
andcor02 25:cb16c5248769 34
andcor02 25:cb16c5248769 35 PIR (PinName pin);
andcor02 25:cb16c5248769 36
andcor02 25:cb16c5248769 37 void pir_interrupt();
andcor02 25:cb16c5248769 38
andcor02 25:cb16c5248769 39 bool getdetection(){return _detection;}
andcor02 25:cb16c5248769 40
andcor02 25:cb16c5248769 41 void resetdetection(){_detection = false;}
andcor02 25:cb16c5248769 42
andcor02 25:cb16c5248769 43 protected:
andcor02 25:cb16c5248769 44 InterruptIn _myint;
andcor02 25:cb16c5248769 45 bool _detection;
andcor02 25:cb16c5248769 46 Timer debounce;
andcor02 25:cb16c5248769 47
andcor02 25:cb16c5248769 48 };
andcor02 25:cb16c5248769 49
andcor02 25:cb16c5248769 50 #endif