Breath

Dependencies:   NeoStrip mbed

Fork of Breath by Ryan Williams

Revision:
0:397523d4133e
Child:
1:86d9b36d9132
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windSensor.h	Thu Dec 01 00:42:08 2016 +0000
@@ -0,0 +1,37 @@
+#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;
+};
\ No newline at end of file