Skip to main content

HeartRate

caution

This service is experimental and may change in the future.

A sensor approximating the heart rate.

Jacdac is NOT suitable for medical devices and should NOT be used in any kind of device to diagnose or treat any medical conditions.

import { HeartRate } from "@devicescript/core"

const heartRate = new HeartRate()

Registers

reading

The estimated heart rate.

  • type: Register<number> (packing format u16.16)

  • read only

import { HeartRate } from "@devicescript/core"

const heartRate = new HeartRate()
// ...
const value = await heartRate.reading.read()
  • track incoming values
import { HeartRate } from "@devicescript/core"

const heartRate = new HeartRate()
// ...
heartRate.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

The estimated error on the reported sensor data.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • read only

import { HeartRate } from "@devicescript/core"

const heartRate = new HeartRate()
// ...
const value = await heartRate.readingError.read()
  • track incoming values
import { HeartRate } from "@devicescript/core"

const heartRate = new HeartRate()
// ...
heartRate.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

The type of physical sensor

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { HeartRate } from "@devicescript/core"

const heartRate = new HeartRate()
// ...
const value = await heartRate.variant.read()
note

write and read will block until a server is bound to the client.