Skip to main content

Potentiometer

A slider or rotary potentiometer.

import { Potentiometer } from "@devicescript/core"

const potentiometer = new Potentiometer()

Registers

reading

The relative position of the slider.

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

  • read only

import { Potentiometer } from "@devicescript/core"

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

const potentiometer = new Potentiometer()
// ...
potentiometer.reading.subscribe(async (value) => {
...
})
note

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

variant

Specifies the physical layout of the potentiometer.

  • 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 { Potentiometer } from "@devicescript/core"

const potentiometer = new Potentiometer()
// ...
const value = await potentiometer.variant.read()
note

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