led

package
v0.0.0-...-aa21e42 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LEDs

type LEDs []RGBColor

LEDs describes a strip of LEDs. It is a preallocated slice of RGBColor.

func NewLEDs

func NewLEDs(numLEDs int) LEDs

NewLEDs creates a new strip of LEDs. Colors are initialized to black (off).

func (LEDs) AsPixels

func (l LEDs) AsPixels() []uint8

AsPixels returns the LED strip as a slice of uint8 values. Each LED is represented by three values, one for each color channel.

func (LEDs) Draw

func (l LEDs) Draw(start int, other LEDs) int

Draw draws the given LEDs into the strip at the given index. It stops when either l or other is exhausted and returns the number of LEDs written.

func (LEDs) Set

func (l LEDs) Set(i int, c RGBColor)

Set sets the color of the LED at the given index.

func (LEDs) SetRange

func (l LEDs) SetRange(start, end int, c RGBColor)

SetRange sets the color of the LEDs in the given range.

func (LEDs) WriteTo

func (l LEDs) WriteTo(w io.Writer) (int64, error)

WriteTo implements io.WriterTo. It writes the LED strip to the given writer as a series of RGBColor values.

type RGBColor

type RGBColor [3]uint8

RGBColor is a color in RGB format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL