Skip to main content

UvIndex

The UV Index is a measure of the intensity of ultraviolet (UV) rays from the Sun.

import { UvIndex } from "@devicescript/core"

const uvIndex = new UvIndex()

Registers

reading

Ultraviolet index, typically refreshed every second.

  • type: Register<number> (packing format u16.16)

  • read only

import { UvIndex } from "@devicescript/core"

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

const uvIndex = new UvIndex()
// ...
uvIndex.reading.subscribe(async (value) => {
...
})
note

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

readingError

Error on the UV measure.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • read only

import { UvIndex } from "@devicescript/core"

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

const uvIndex = new UvIndex()
// ...
uvIndex.readingError.subscribe(async (value) => {
...
})
note

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

variant

The type of physical sensor and capabilities.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { UvIndex } from "@devicescript/core"

const uvIndex = new UvIndex()
// ...
const value = await uvIndex.variant.read()
note

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