找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1411|回复: 8
收起左侧

最近在看MAX30102,苦于是英文文档有哪位大哥有中文文档吗?或者流程

[复制链接]
ID:155507 发表于 2022-6-11 17:24 | 显示全部楼层
MAX30102是一款基于PPG((PhotoPlethysmoGraphy)的集成脉搏血氧仪和心率监测生物传感器模块。体积小,可以戴在手指或手腕上进行数据采集。内部集成18bit ADC,传感器支持I2C 数据输出,可兼容大多数控制器。

  1. /*!
  2. * @file basicRead.ino
  3. * @brief Output readings of red light and IR
  4. * @n This library supports mainboards: ESP8266, FireBeetle-M0, UNO, ESP32, Leonardo, Mega2560
  5. * @copyright  Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
  6. * @licence     The MIT License (MIT)
  7. * @author [YeHangYu](hangyu.ye@dfrobot.com)
  8. * @version  V0.1
  9. * @date  2020-05-29
  10. * @url https://github.com/DFRobot/DFRobot_MAX30102
  11. */

  12. #include <DFRobot_MAX30102.h>

  13. DFRobot_MAX30102 particleSensor;

  14. /*
  15. Macro definition opions in sensor configuration
  16. sampleAverage: SAMPLEAVG_1 SAMPLEAVG_2 SAMPLEAVG_4
  17.                SAMPLEAVG_8 SAMPLEAVG_16 SAMPLEAVG_32
  18. ledMode:       MODE_REDONLY  MODE_RED_IR  MODE_MULTILED
  19. sampleRate:    PULSEWIDTH_69 PULSEWIDTH_118 PULSEWIDTH_215 PULSEWIDTH_411
  20. pulseWidth:    SAMPLERATE_50 SAMPLERATE_100 SAMPLERATE_200 SAMPLERATE_400
  21.                SAMPLERATE_800 SAMPLERATE_1000 SAMPLERATE_1600 SAMPLERATE_3200
  22. adcRange:      ADCRANGE_2048 ADCRANGE_4096 ADCRANGE_8192 ADCRANGE_16384
  23. */
  24. void setup()
  25. {
  26.   //Init serial
  27.   Serial.begin(115200);
  28.   /*!
  29.    *@brief Init sensor
  30.    *@param pWire IIC bus pointer object and construction device, can both pass or not pass parameters (Wire in default)
  31.    *@param i2cAddr Chip IIC address (0x57 in default)
  32.    *@return true or false
  33.    */
  34.   while (!particleSensor.begin()) {
  35.     Serial.println("MAX30102 was not found");
  36.     delay(1000);
  37.   }

  38.   /*!
  39.    *@brief Use macro definition to configure sensor
  40.    *@param ledBrightness LED brightness, default value: 0x1F(6.4mA), Range: 0~255(0=Off, 255=50mA)
  41.    *@param sampleAverage Average multiple samples then draw once, reduce data throughput, default 4 samples average
  42.    *@param ledMode LED mode, default to use red light and IR at the same time
  43.    *@param sampleRate Sampling rate, default 400 samples every second
  44.    *@param pulseWidth Pulse width: the longer the pulse width, the wider the detection range. Default to be Max range
  45.    *@param adcRange Measurement Range, default 4096 (nA), 15.63(pA) per LSB
  46.    */
  47.   particleSensor.sensorConfiguration(/*ledBrightness=*/0x1F, /*sampleAverage=*/SAMPLEAVG_4, \
  48.                                   /*ledMode=*/MODE_MULTILED, /*sampleRate=*/SAMPLERATE_400, \
  49.                                   /*pulseWidth=*/PULSEWIDTH_411, /*adcRange=*/ADCRANGE_4096);
  50. }

  51. void loop()
  52. {
  53.   //Print result
  54.   Serial.print("R=");
  55.   /*!
  56.    *@brief Get red value
  57.    *@return Red light reading
  58.    */
  59.   Serial.print(particleSensor.getRed());
  60.   Serial.print(" IR=");
  61.   /*!
  62.    *@brief Get IR value
  63.    *@return IR reading
  64.    */
  65.   Serial.print(particleSensor.getIR());
  66.   Serial.println();
  67.   delay(100);
  68. }
复制代码
回复

使用道具 举报

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

本版积分规则

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

Powered by 单片机教程网

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