zinnet yazıcı
/
max30105Example
maxrefdes117
Diff: main.cpp
- Revision:
- 0:78a2573ad768
diff -r 000000000000 -r 78a2573ad768 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Aug 06 12:19:46 2019 +0000 @@ -0,0 +1,61 @@ + +#include "MAX30105.h" +#include "heartRate.h" +#include "spo2_algorithm.h" +#include "mbed.h" + +I2C i2c(I2C_SDA, I2C_SCL); +MAX30105 max30105(i2c); + +Serial pc(USBTX, USBRX); +MAX30105 particleSensor; + +DigitalIn INT(PA_5); + +void restart(); +void measureBPM(); + +void(* resetFunc) (void) = 0; + +bool nofinger=false; +bool programStarted=false; + +int RATE_SIZE=0; //Increase this for more averaging. 4 is good. +int rate[1000]; //Array of heart rates +long lastBeat = 0; //Time at which the last beat occurred + +float beatsPerMinute; +int beatAvg; + +long now=0; +int bpm = 0; +int mins=0; +int ten_secs=10; +int avg=0; + +long t= Timer(); + +void setup () +{ + pc.baud(9600); + pc.format(8,SerialBase::None,1); + wait(1); + particleSensor.setup(); + } + + int main(){ + setup(); + pc.printf(" R["); + pc.printf("%i",particleSensor.getRed()); + pc.printf("] IR["); + pc.printf("%i",particleSensor.getIR()); + pc.printf("] G["); + pc.printf("%i",particleSensor.getGreen()); + pc.printf("]"); + +} + + + + +