ws2812

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 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
}

Device wraps a pin object for an easy driver interface.

func New

func New(pin machine.Pin) Device

New returns a new WS2812 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) error

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

Jump to

Keyboard shortcuts

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