pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

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)

API

hat_heartrate_0.getHeartRate()
  • Retrieves heart rate data.
hat_heartrate_0.getIr()
  • Gets the infrared raw ADC value.
hat_heartrate_0.getRed()
  • Gets the red light raw ADC value.
hat_heartrate_0.getSpO2()
  • Retrieves blood oxygen saturation (SpO2) data.
hat_heartrate_0.setLedCurrent(0x00, 0x00)
  • Sets the current values for the red and infrared LEDs.
hat_heartrate_0.setMode(0x02)
  • Sets the mode for heart rate or other measurements.
On This Page