pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Unit Heart

Example

Output heart rate and blood oxygen data

from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit

setScreenColor(0x222222)
heart_0 = unit.get(unit.HEART, unit.PORTA)

heart_0.setLedCurrent(0x04, 0x01)
heart_0.setMode(0x03)
while True:
  print((str('heart rate:') + str((heart_0.getHeartRate()))))
  print((str('spo2') + str((heart_0.getSpO2()))))
  wait(0.3)
  wait_ms(2)

API

print(heart_0.getHeartRate())
  • Get heart rate
print(heart_0.getSpO2())
  • Get SpO2
heart_0.setLedCurrent(0x00, 0x00)
  • Set led current
heart_0.setMode(0x02)
  • Set the mode of HeartUnit
    • Heart Rate
    • Heart Rate with SpO2
On This Page