找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2597|回复: 4
打印 上一主题 下一主题
收起左侧

求教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();
    }
}

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:528780 发表于 2019-5-6 17:32 | 只看该作者
我用30102也遇到同样问题
回复

使用道具 举报

板凳
ID:712072 发表于 2020-7-15 09:14 | 只看该作者
请问你解决了吗?我也碰到了同样的问题
回复

使用道具 举报

地板
ID:712072 发表于 2020-7-15 09:15 | 只看该作者
请问你解决了吗?我也碰到了这个问题
回复

使用道具 举报

5#
ID:750420 发表于 2020-10-20 19:20 | 只看该作者
解决了,参考这篇博文https://blog.csdn.net/JaLLs/article/details/99708019,包括需要下载的zip库都有再评论区给你
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表