![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Breath
Fork of Breath by
Diff: windSensor.h
- Revision:
- 0:397523d4133e
- Child:
- 1:86d9b36d9132
diff -r 000000000000 -r 397523d4133e windSensor.h --- /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