Driver for a binary on/off presence device

Dependents:   mbed-IBooth-ETH

Presence.h

Committer:
andcor02
Date:
2015-02-11
Revision:
7:f12e18827f3e
Parent:
1:9d2b641a9280

File content as of revision 7:f12e18827f3e:

/*
    presence.cpp -  presence sensor library
    Developed by Andrea Corrado & Eric Gowland
    
    Connect to a hardware device that is boolean present/not present. Such as PIR or Rangefinder with appropriate signalling.
    Also drives LED as presence indicator.
*/

#ifndef MBED_PIR_H
#define MBED_PIR_H

#include "mbed.h"

class presence{
    
public:

    presence(PinName pin, bool true_on_rise, int debounce_time_ms);
    bool isPresent();
    
private:
    InterruptIn _myint;
    DigitalOut _led1;
    bool _detection;
    bool _true_on_rise;
    int debounce_ms;
    Timer debounce_timer;
    void presence_interrupt_on();
    void presence_interrupt_off();
    
};

#endif