Skip to main content

Status Light

DeviceScript uses various blinking patterns on the status LED to message application states.

Controlling the status led

You can set the status LED (until a system LED pattern is scheduled by the runtime) using the setStatusLight function.

import { delay } from "@devicescript/core"
import { setStatusLight } from "@devicescript/runtime"

setInterval(async () => {
await setStatusLight(0x00ff00) // green
await delay(500)
await setStatusLight(0x000000) // off
}, 500)

Network connectivity

  • connecting to network: slow yellow glow
  • connecting to gateway: fast yellow glow
  • connected to gateway: very slow blue glow
  • not connected to cloud: very slow red

Gateway messages

  • message uploaded: purple short blink
  • message failed to upload: red short blink

Errors

  • jacdac line error: yellow blink
  • packet overflow: magenta blink
  • generic error: short red blink

The blinking patterns are defined at https://github.com/microsoft/jacdac-c/blob/main/inc/jd_io.h#L77