Class Led

A RGB led

Export

Hierarchy

  • Led

Constructors

  • Creates an instance of the Led class.

    Parameters

    • red: number

      Red value (0-255).

    • green: number

      Green value (0-255).

    • blue: number

      Blue value (0-255).

    Returns Led

Properties

blue: number
green: number
red: number

Methods

  • Brightens the LED color by a specified factor.

    Parameters

    • factor: number

      Brightness factor (e.g., 1.2 is 20% brighter).

    Returns Led

    The updated Led instance.

  • Desaturates the LED color by a specified factor.

    Parameters

    • factor: number

      Desaturation factor (1 for full grayscale, 0 for no change).

    Returns Led

    The updated Led instance.

  • Dims the LED color by a specified factor.

    Parameters

    • factor: number

      Dim factor (e.g., 0.8 is 20% dimmer).

    Returns Led

    The updated Led instance.

  • Inverts the RGB values.

    Returns Led

    The updated Led instance.

  • Checks if the LED color is turned on (non-zero).

    Returns boolean

    True if the LED is on, false otherwise.

  • Saturates the LED color by a specified factor.

    Parameters

    • factor: number

      Saturation factor (greater than 1 to saturate, between 0 and 1 to desaturate).

    Returns Led

    The updated Led instance.

  • Sets the RGB values to the specified values.

    Parameters

    • red: number

      New red value.

    • green: number

      New green value.

    • blue: number

      New blue value.

    Returns Led

    The updated Led instance.

  • Converts the RGB values to a Uint8Array.

    Returns Uint8Array

    The RGB values in a Uint8Array format.

  • Returns a string representation of the RGB values.

    Returns string

    String in the format 'rgb(r, g, b)'.

  • Sets all RGB values to 0, turning the LED off.

    Returns Led

    The updated Led instance.

Generated using TypeDoc