Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define USE_ARDUINO_INTERRUPTS true
- #include <Wire.h>
- #include <SHT21.h>
- #include "MAX30100_PulseOximeter.h"
- SHT21 sht;
- float temp;
- #define REPORTING_PERIOD_MS 1000
- PulseOximeter pox;
- uint32_t tsLastReport = 0;
- void onBeatDetected()
- {
- //Serial.println("Beat!");
- }
- void setup()
- {
- Serial.begin(115200);
- //Wire.begin();
- //Serial.print("Initializing pulse oximeter..");
- // Initialize the PulseOximeter instance
- // Failures are generally due to an improper I2C wiring, missing power supply
- // or wrong target chip
- if (!pox.begin()) {
- //Serial.println("FAILED");
- for (;;);
- } else {
- //Serial.println("SUCCESS");
- }
- //pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);
- // Register a callback for the beat detection
- //pox.setOnBeatDetectedCallback(onBeatDetected);
- }
- void loop()
- {
- // Make sure to call update as fast as possible
- pox.update();
- if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
- //Serial.print("Heart rate:");
- temp = sht.getTemperature();
- //if (pox.getHeartRate() > 60) {
- Serial.print(pox.getHeartRate());
- Serial.print(", ");
- Serial.print(temp);
- Serial.print(",");
- Serial.println("end");
- //Serial.print("bpm / SpO2:");
- //Serial.print(pox.getSpO2());
- //Serial.println("%");
- //}
- tsLastReport = millis();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement