blinkt

package module
v0.0.0-...-cc0ca16 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2018 License: MIT Imports: 6 Imported by: 3

README

blinkt_go

This library is work-in-progress and makes use of WiringPi and the Golang rpi library.

Instructions:

Install Go

If you don't have Go on the Pi, download it from: https://golang.org/dl/ and pick the armv6l edition.

sudo tar -xvf go1.7.4.linux-armv6l.tar.gz -C /usr/local/
export GOPATH=$HOME/go
Install WiringPi
# sudo apt-get install -qy wiringpi
Install and build blinkt! library
# export GOPATH=$HOME/go/
# mkdir -p $GOPATH/src/github.com/alexellis/
# cd $GOPATH/src/github.com/alexellis/

# git clone https://github.com/alexellis/blinkt_go && cd blinkt_go

# go get
# go build
# sudo ./blinkt_go

sysfs implementation and Docker Swarm

Docker Swarm cannot run the main version of this library because WiringPi needs elevated privileges.

To use this library with Docker Swarm please use the version of Blinkt in the sysfs package.

For more information on sysfs see: http://elinux.org/RPi_GPIO_Code_Samples#sysfs

Documentation

Index

Constants

View Source
const CLK int = 24
View Source
const DAT int = 23

Variables

This section is empty.

Functions

func Delay

func Delay(ms int)

Delay maps to time.Sleep, for ms milliseconds

Types

type Blinkt

type Blinkt struct {
	// contains filtered or unexported fields
}

Blinkt use the NewBlinkt function to initialize the pixels property.

func NewBlinkt

func NewBlinkt(brightness ...float64) Blinkt

NewBlinkt creates a Blinkt to interact with. You must call "Setup()" immediately afterwards.

func (*Blinkt) Clear

func (bl *Blinkt) Clear()

Clear sets all the pixels to off, you still have to call Show.

func (*Blinkt) SetAll

func (bl *Blinkt) SetAll(r int, g int, b int) *Blinkt

SetAll sets all pixels to specified r, g, b colour. Show must be called to update the LEDs.

func (*Blinkt) SetBrightness

func (bl *Blinkt) SetBrightness(brightness float64) *Blinkt

SetBrightness sets the brightness of all pixels. Brightness supplied should be between: 0.0 to 1.0

func (*Blinkt) SetClearOnExit

func (bl *Blinkt) SetClearOnExit(clearOnExit bool)

SetClearOnExit turns all pixels off on Control + C / os.Interrupt signal.

func (*Blinkt) SetPixel

func (bl *Blinkt) SetPixel(p int, r int, g int, b int) *Blinkt

SetPixel sets an individual pixel to specified r, g, b colour. Show must be called to update the LEDs.

func (*Blinkt) SetPixelBrightness

func (bl *Blinkt) SetPixelBrightness(p int, brightness float64) *Blinkt

SetPixelBrightness sets the brightness of pixel p. Brightness supplied should be between: 0.0 to 1.0

func (*Blinkt) Setup

func (bl *Blinkt) Setup()

Setup initializes GPIO via WiringPi base library.

func (*Blinkt) Show

func (bl *Blinkt) Show()

Show updates the LEDs with the values from SetPixel/Clear.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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