breath sensor library

Committer:
otis22894
Date:
Thu Dec 01 00:42:08 2016 +0000
Revision:
0:397523d4133e
Child:
1:d07f80ef7abc
initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
otis22894 0:397523d4133e 1 #include "mbed.h"
otis22894 0:397523d4133e 2 #include "NeoStrip.h"
otis22894 0:397523d4133e 3 #include <vector>
otis22894 0:397523d4133e 4
otis22894 0:397523d4133e 5 class windSensor {
otis22894 0:397523d4133e 6 public:
otis22894 0:397523d4133e 7 windSensor(PinName p, NeoStrip *_strip);
otis22894 0:397523d4133e 8 /* Start victim breath */
otis22894 0:397523d4133e 9 void sample();
otis22894 0:397523d4133e 10 void startReading();
otis22894 0:397523d4133e 11 void stopReading();
otis22894 0:397523d4133e 12 void reset();
otis22894 0:397523d4133e 13 bool breathDetected();
otis22894 0:397523d4133e 14 /* End vicim breath */
otis22894 0:397523d4133e 15
otis22894 0:397523d4133e 16 /* start give breath */
otis22894 0:397523d4133e 17 float give_breath(void);
otis22894 0:397523d4133e 18 /* end give breath */
otis22894 0:397523d4133e 19
otis22894 0:397523d4133e 20 private:
otis22894 0:397523d4133e 21 /* start vicim breath */
otis22894 0:397523d4133e 22 AnalogIn sensor;
otis22894 0:397523d4133e 23 Ticker breathReader;
otis22894 0:397523d4133e 24
otis22894 0:397523d4133e 25 volatile float thresh;
otis22894 0:397523d4133e 26 //volatile bool Breath = false; // set on each visit to interrupt routine
otis22894 0:397523d4133e 27 volatile bool isBreathing;
otis22894 0:397523d4133e 28 volatile int breathCount; //increment if breath is above thresh on each visit to interrupt routine
otis22894 0:397523d4133e 29 /* end victim breath */
otis22894 0:397523d4133e 30
otis22894 0:397523d4133e 31 /* start give breath */
otis22894 0:397523d4133e 32 Timer t, q;
otis22894 0:397523d4133e 33 vector<float> b;
otis22894 0:397523d4133e 34 /* end give breath */
otis22894 0:397523d4133e 35 vector<float> c;
otis22894 0:397523d4133e 36 NeoStrip *strip;
otis22894 0:397523d4133e 37 };