Skip to main content

PressureButton

caution

This service is rc and may change in the future.

A pressure sensitive push-button.

import { PressureButton } from "@devicescript/core"

const pressureButton = new PressureButton()

Registers

activeThreshold

Indicates the threshold for up events.

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

  • read and write

import { PressureButton } from "@devicescript/core"

const pressureButton = new PressureButton()
// ...
const value = await pressureButton.activeThreshold.read()
await pressureButton.activeThreshold.write(value)
  • track incoming values
import { PressureButton } from "@devicescript/core"

const pressureButton = new PressureButton()
// ...
pressureButton.activeThreshold.subscribe(async (value) => {
...
})
note

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