标题: 求教max30100在网上找的Arduino代码不行 [打印本页]

作者: 1039736184    时间: 2019-4-21 21:45
标题: 求教max30100在网上找的Arduino代码不行
帮忙看下哪里有问题(在网上找的代码),运行后灯不亮,串口只显示Beat



#include <Wire.h>
#include "MAX30100_PulseOximeter.h"

#define REPORTING_PERIOD_MS     1000

// PulseOximeter is the higher level interface to the sensor
// it offers:
//  * beat detection reporting
//  * heart rate calculation
//  * SpO2 (oxidation level) calculation
PulseOximeter pox;

uint32_t tsLastReport = 0;

// Callback (registered below) fired when a pulse is detected
void onBeatDetected()
{
    Serial.println("Beat!");
}

void setup()
{
    Serial.begin(115200);

    // Initialize the PulseOximeter instance and register a beat-detected callback
    pox.begin();
    pox.setOnBeatDetectedCallback(onBeatDetected);
}

void loop()
{
    // Make sure to call update as fast as possible
    pox.update();

    // Asynchronously dump heart rate and oxidation levels to the serial
    // For both, a value of 0 means "invalid"
    if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
        Serial.print("Heart rate:");
        Serial.print(pox.getHeartRate());
        Serial.print("bpm / SpO2:");
        Serial.print(pox.getSpO2());
        Serial.println("%");

        tsLastReport = millis();
    }
}


作者: 阳明    时间: 2019-5-6 17:32
我用30102也遇到同样问题

作者: 395164965    时间: 2020-7-15 09:14
请问你解决了吗?我也碰到了同样的问题
作者: 395164965    时间: 2020-7-15 09:15
请问你解决了吗?我也碰到了这个问题
作者: wyqf    时间: 2020-10-20 19:20
解决了,参考这篇博文https://blog.csdn.net/JaLLs/article/details/99708019,包括需要下载的zip库都有再评论区给你




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1