Skip to main content

Illuminance

caution

This service is rc and may change in the future.

Detects the amount of light falling onto a given surface area.

Note that this is different from luminance, the amount of light that passes through, emits from, or reflects off an object.

import { Illuminance } from "@devicescript/core"

const illuminance = new Illuminance()

Registers

reading

The amount of illuminance, as lumens per square metre.

  • type: Register<number> (packing format u22.10)

  • read only

import { Illuminance } from "@devicescript/core"

const illuminance = new Illuminance()
// ...
const value = await illuminance.reading.read()
  • track incoming values
import { Illuminance } from "@devicescript/core"

const illuminance = new Illuminance()
// ...
illuminance.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Error on the reported sensor value.

  • type: Register<number> (packing format u22.10)

  • optional: this register may not be implemented

  • read only

import { Illuminance } from "@devicescript/core"

const illuminance = new Illuminance()
// ...
const value = await illuminance.readingError.read()
  • track incoming values
import { Illuminance } from "@devicescript/core"

const illuminance = new Illuminance()
// ...
illuminance.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.