Skip to main content


A potentiometer (slider or rotary) is used to control the brightness (intensity register) of a light bulb. This example uses a Raspberry Pi pico but could be redone using other devices.

import { pins } from "@dsboard/pico"
import { startLightBulb, startPotentiometer } from "@devicescript/servers"

// starting a potentiometer driver on GP26
// pinout
const slider = startPotentiometer({
pin: pins.GP26,
// starting a dimmieable light on pin GP2
const led = startLightBulb({
pin: pins.GP7,
dimmable: true,

// subscribing to the slider readings and sending them to the intensity register
slider.reading.subscribe(async level => {
await led.intensity.write(level)