blinkt

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

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

Go to latest
Published: Jun 16, 2019 License: MIT Imports: 7 Imported by: 0

README

Go-Blinkt-RPi

Library written in Go to allow controlling of the Pimoroni Blinkt on a Raspberry Pi.

Usage

  1. go get github.com/adrianh-za/go-blinkt-rpi
  2. browse to $/go/src/github.com/adrianh-za/go-blinkt-rpi/examples
  3. sudo -E go run [filename].go
  4. ctrl-c to quit

Examples filenames

  • colours.go
  • kitt-colours.go
  • kitt.go
  • rainbow.go
  • rainbow2.go

Acknowledgements

This project draws inspiration and borrows heavily from the work done by Alex Ellis and Isaac "Ike" Arias.

Gits

https://github.com/ikester/gpio

https://github.com/ikester/blinkt

https://github.com/alexellis/blinkt_go

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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