pdf-icon

UIFlow Guide

UiFlow1 Blockly

Event

Unit

UiFlow1 Project

Hat Heart Rate

Example

Retrieves heart rate and blood oxygen values.

from m5stack import *
from m5ui import *
from uiflow import *
import time
import hat

setScreenColor(0x111111)

hat_heartrate_0 = hat.get(hat.HEART_RATE)

hat_heartrate_0.setMode(0x03)
while True:
  print(hat_heartrate_0.getHeartRate())
  print(hat_heartrate_0.getSpO2())
  wait(0.4)
  wait_ms(2)
Copy

API

hat_heartrate_0.getHeartRate()
Copy
  • Retrieves heart rate data.
hat_heartrate_0.getIr()
Copy
  • Gets the infrared raw ADC value.
hat_heartrate_0.getRed()
Copy
  • Gets the red light raw ADC value.
hat_heartrate_0.getSpO2()
Copy
  • Retrieves blood oxygen saturation (SpO2) data.
hat_heartrate_0.setLedCurrent(0x00, 0x00)
Copy
  • Sets the current values for the red and infrared LEDs.
hat_heartrate_0.setMode(0x02)
Copy
  • Sets the mode for heart rate or other measurements.
On This Page
Example
API
Q&A
Submit a question
Select question category*
Arduino
MicroPython
UIFlow1
UIFlow2
EzData
M5Burner
Software
Hardware
Other
Product name
Product version
Question description*
(Supports pasting screenshots.)
Attachments
Add Files
Email*
Submit
OK

M5Stack Support

Hi, this is M5Stack Support. How can I help you today?