ws2812

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: BSD-3-Clause Imports: 3 Imported by: 93

Documentation

Overview

Package ws2812 implements a driver for WS2812 and SK6812 RGB LED strips.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	Pin machine.Pin
	// contains filtered or unexported fields
}

Device wraps a pin object for an easy driver interface.

func New

func New(pin machine.Pin) Device

deprecated, use NewWS2812 or NewSK6812 depending on which device you want. calls NewWS2812() to avoid breaking everyone's existing code.

func NewSK6812 added in v0.27.0

func NewSK6812(pin machine.Pin) Device

New returns a new SK6812(RGBA) driver. It does not touch the pin object: you have to configure it as an output pin before calling New.

func NewWS2812 added in v0.27.0

func NewWS2812(pin machine.Pin) Device

New returns a new WS2812(RGB) driver. It does not touch the pin object: you have to configure it as an output pin before calling New.

func (Device) Write

func (d Device) Write(buf []byte) (n int, err error)

Write the raw bitstring out using the WS2812 protocol.

func (Device) WriteByte added in v0.9.0

func (d Device) WriteByte(c byte) error

Send a single byte using the WS2812 protocol.

func (Device) WriteColors

func (d Device) WriteColors(buf []color.RGBA) (err error)

Write the given color slice out using the WS2812 protocol. Colors are sent out in the usual GRB(A) format.

Jump to

Keyboard shortcuts

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