Demo Team / Presence

Dependents:   mbed-IBooth-ETH

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Presence.h Source File

Presence.h

00001 /*
00002     presence.cpp -  presence sensor library
00003     Developed by Andrea Corrado & Eric Gowland
00004     
00005     Connect to a hardware device that is boolean present/not present. Such as PIR or Rangefinder with appropriate signalling.
00006     Also drives LED as presence indicator.
00007 */
00008 
00009 #ifndef MBED_PIR_H
00010 #define MBED_PIR_H
00011 
00012 #include "mbed.h"
00013 
00014 class presence{
00015     
00016 public:
00017 
00018     presence(PinName pin, bool true_on_rise, int debounce_time_ms);
00019     bool isPresent();
00020     
00021 private:
00022     InterruptIn _myint;
00023     DigitalOut _led1;
00024     bool _detection;
00025     bool _true_on_rise;
00026     int debounce_ms;
00027     Timer debounce_timer;
00028     void presence_interrupt_on();
00029     void presence_interrupt_off();
00030     
00031 };
00032 
00033 #endif