Skip to main content

Potentiometer

The startPotentiometer starts a simple analog sensor server that models a potentiometer and returns a client bound to the server.

import { gpio } from "@devicescript/core"
import { startPotentiometer } from "@devicescript/servers"

const sensor = startPotentiometer({
pin: ds.gpio(3),
})
sensor.reading.subscribe(v => console.data({ value: 100 * v }))