Skip to main content

Soil Moisture

The startSoilMoisture starts a simple analog sensor server that models a soil moisture sensor and returns a client bound to the server.

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

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