Skip to main content

Reflected Light

The startReflectedLight starts a simple analog sensor server that models a reflected light sensor and returns a client bound to the server.

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

const sensor = startReflectedLight({
pin: ds.gpio(3),
})
sensor.reading.subscribe(brightness => console.data({ brightness }))