Documentation
¶
Overview ¶
Package dotstar implements a driver for the dotstar LEDs.
Example ¶
package main
import (
"github.com/goiot/devices/dotstar"
"golang.org/x/exp/io/spi"
)
func main() {
d, err := dotstar.Open( // a strip with 5 LEDs
&spi.Devfs{Dev: "/dev/spi0.1", Mode: spi.Mode3}, 5)
if err != nil {
panic(err)
}
d.SetRGBA(0, dotstar.RGBA{255, 0, 0, 16}) // Red
d.SetRGBA(1, dotstar.RGBA{0, 255, 0, 16}) // Green
d.SetRGBA(2, dotstar.RGBA{0, 0, 255, 16}) // Blue
d.SetRGBA(3, dotstar.RGBA{255, 0, 0, 8}) // Half dim red
d.SetRGBA(4, dotstar.RGBA{0, 0, 255, 8}) // Half dim blue
if err := d.Draw(); err != nil {
panic(err)
}
}
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LEDs ¶
type LEDs struct {
// Device is the underlying SPI bus that is used to communicate the
// LED strip. Most users don't have to access this field.
Device *spi.Device
// contains filtered or unexported fields
}
LEDs represent a strip of dotstar LEDs.
func Open ¶
Open opens a new LED strip with n dotstar LEDs. An LED strip must be closed if no longer in use.
func (*LEDs) Close ¶
Close frees the underlying resources. It must be called once the LED strip is no longer in use.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
helloworld
command
Package main contains a program that drives a dotstar LED strip.
|
Package main contains a program that drives a dotstar LED strip. |
|
random
command
Package main contains a program that drives a dotstar LED strip.
|
Package main contains a program that drives a dotstar LED strip. |
Click to show internal directories.
Click to hide internal directories.

