devicescript icon indicating copy to clipboard operation
devicescript copied to clipboard

something like this?

Open tballmsft opened this issue 2 years ago • 2 comments

Here's start of a very simple sample with input (sensor) and output (traffic light).


console.log("starting...")
const temp = new ds.Temperature()
const light = new ds.TrafficLight()
temp.temperature.subscribe(async t => {
    console.log(t)
    await light.green.write(false)
    await light.yellow.write(false)
    await light.red.write(false)
    if (t > 30) {
        await light.red.write(true)
    } else if (t > 20) {
        await light.yellow.write(true)
    } else {
        await light.green.write(true)
    }
})

tballmsft avatar Mar 14 '23 21:03 tballmsft

image

tballmsft avatar Mar 14 '23 21:03 tballmsft

not sure what the ask is.

pelikhan avatar Mar 24 '23 20:03 pelikhan

added sample https://github.com/microsoft/devicescript/commit/2544de05e56455a0f7abd3252adb1a994a6d1920

pelikhan avatar Jul 21 '23 15:07 pelikhan