Skip to main content

Flex

caution

This service is rc and may change in the future.

A bending or deflection sensor.

import { Flex } from "@devicescript/core"

const flex = new Flex()

Registers

reading

A measure of the bending.

  • type: Register<number> (packing format i1.15)

  • read only

import { Flex } from "@devicescript/core"

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

const flex = new Flex()
// ...
flex.reading.subscribe(async (value) => {
...
})
note

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

length

Length of the flex sensor

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

  • optional: this register may not be implemented

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

  • read only

import { Flex } from "@devicescript/core"

const flex = new Flex()
// ...
const value = await flex.length.read()
note

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