breath sensor library

windSensor.h

Committer:
otis22894
Date:
2016-12-01
Revision:
0:397523d4133e
Child:
1:d07f80ef7abc

File content as of revision 0:397523d4133e:

#include "mbed.h"
#include "NeoStrip.h"
#include <vector>

class windSensor {
public:
    windSensor(PinName p, NeoStrip *_strip);
    /* Start victim breath */
    void sample();
    void startReading();
    void stopReading();
    void reset();
    bool breathDetected();
    /* End vicim breath */
    
    /* start give breath */
    float give_breath(void);
    /* end give breath */
    
private:
    /* start vicim breath */
    AnalogIn sensor;
    Ticker breathReader;

    volatile float thresh;
    //volatile bool Breath = false;     // set on each visit to interrupt routine
    volatile bool isBreathing;
    volatile int breathCount; //increment if breath is above thresh on each visit to interrupt routine
    /* end victim breath */
    
    /* start give breath */
    Timer t, q;
    vector<float> b;
    /* end give breath */
    vector<float> c;
    NeoStrip *strip;
};