Help us shape the future of Go! Take the 2026 Go Developer Survey

blinkt

package module
v0.0.0-...-609ac31 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2017 License: MIT Imports: 7 Imported by: 2

README

A Golang library for the Pimoroni Blinkt

The Pimoroni Blinkt is a low-profile strip of eight super-bright, color LED indicators that plugs directly onto the Raspberry Pi's GPIO header. Several available software libraries make it easy to control the color and brightness of each LED independently.

This is a re-implementation of Pimoroni's Python library, written in Go.

How It Works

TBD

Acknowledgements

This project draws inspiration and borrows heavily from the work done by @alexellis on Docker on Raspberry Pis and his Blinkt Go libraries, themselves based on work by @gamaral for using the /sys/ fs interface instead of special libraries or elevated privileges to /dev/mem on the Raspberry Pi.

Requirements

Physically install a Pimoroni Blinkt on the Raspberry Pi. No additional sofware or setup is required for the Blinkt.

Usage

TBD

License

This library is made available under an MIT-style License. See LICENSE.

Documentation

Index

Constants

View Source
const CLK int = 24

CLK is the clock pin for Blinkt

View Source
const DAT int = 23

DAT is the Data pin for Blinkt

Variables

This section is empty.

Functions

func Hex2RGB

func Hex2RGB(color string) (int, int, int)

Hex2RGB converts a hexadecimal color string (e.g. #FFCC66) to RGB

Types

type Blinkt

type Blinkt struct {
	ShowAnimOnStart bool
	CaptureExit     bool
	ShowAnimOnExit  bool
	ClearOnExit     bool
	// contains filtered or unexported fields
}

Blinkt holds the pixel array and related functions

func NewBlinkt

func NewBlinkt(brightness ...float64) Blinkt

NewBlinkt creates a Blinkt to interact with. You must call "Setup()" after initial config.

func (*Blinkt) Cleanup

func (bl *Blinkt) Cleanup()

Cleanup does final cleanup of resources

func (*Blinkt) Clear

func (bl *Blinkt) Clear()

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

func (*Blinkt) FlashAll

func (bl *Blinkt) FlashAll(times int, color string)

FlashAll will flash all pixels on and off specified times and color

func (*Blinkt) FlashPixel

func (bl *Blinkt) FlashPixel(pixel, times int, color string)

FlashPixel will flash a pixel on and off specified times and color

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) 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) SetPixelHex

func (bl *Blinkt) SetPixelHex(p int, color string) *Blinkt

SetPixelHex sets an individual pixel to specified Hex colour. Show must be called to update the LEDs.

func (*Blinkt) Setup

func (bl *Blinkt) Setup()

Setup gets Blinkt ready to display

func (*Blinkt) SetupExit

func (bl *Blinkt) SetupExit()

SetupExit captures Interrupt and SIGTERM signals to handle program exit

func (*Blinkt) Show

func (bl *Blinkt) Show() *Blinkt

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

func (*Blinkt) ShowFinalAnim

func (bl *Blinkt) ShowFinalAnim()

ShowFinalAnim displays a "start" light animation

func (*Blinkt) ShowInitialAnim

func (bl *Blinkt) ShowInitialAnim()

ShowInitialAnim displays a "start" light animation

Jump to

Keyboard shortcuts

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