Skip to main content

SevenSegmentDisplay

caution

This service is rc and may change in the future.

A 7-segment numeric display, with one or more digits.

import { SevenSegmentDisplay } from "@devicescript/core"

const sevenSegmentDisplay = new SevenSegmentDisplay()

Commands

setNumber

Shows the number on the screen using the decimal dot if available.

sevenSegmentDisplay.setNumber(value: number): Promise<void>

Registers

intensity

Controls the brightness of the LEDs. 0 means off.

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

  • optional: this register may not be implemented

  • read and write

import { SevenSegmentDisplay } from "@devicescript/core"

const sevenSegmentDisplay = new SevenSegmentDisplay()
// ...
const value = await sevenSegmentDisplay.intensity.read()
await sevenSegmentDisplay.intensity.write(value)
  • track incoming values
import { SevenSegmentDisplay } from "@devicescript/core"

const sevenSegmentDisplay = new SevenSegmentDisplay()
// ...
sevenSegmentDisplay.intensity.subscribe(async (value) => {
...
})
note

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

doubleDots

Turn on or off the column LEDs (separating minutes from hours, etc.) in of the segment. If the column LEDs is not supported, the value remains false.

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

  • optional: this register may not be implemented

  • read and write

import { SevenSegmentDisplay } from "@devicescript/core"

const sevenSegmentDisplay = new SevenSegmentDisplay()
// ...
const value = await sevenSegmentDisplay.doubleDots.read()
await sevenSegmentDisplay.doubleDots.write(value)
  • track incoming values
import { SevenSegmentDisplay } from "@devicescript/core"

const sevenSegmentDisplay = new SevenSegmentDisplay()
// ...
sevenSegmentDisplay.doubleDots.subscribe(async (value) => {
...
})
note

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

digitCount

The number of digits available on the display.

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

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

  • read only

import { SevenSegmentDisplay } from "@devicescript/core"

const sevenSegmentDisplay = new SevenSegmentDisplay()
// ...
const value = await sevenSegmentDisplay.digitCount.read()
note

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

decimalPoint

True if decimal points are available (on all digits).

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

  • optional: this register may not be implemented

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

  • read only

import { SevenSegmentDisplay } from "@devicescript/core"

const sevenSegmentDisplay = new SevenSegmentDisplay()
// ...
const value = await sevenSegmentDisplay.decimalPoint.read()
note

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