Giter Club home page Giter Club logo

go-rpi-ws281x's Introduction

go-rpi-ws281x GoDoc

golang binding for rpi_ws281x, userspace Raspberry Pi PWM library for WS281X LEDs. Supports any Raspberry and WS2812, SK6812RGB and SK6812RGBW LEDs strips, this includes Unicorn pHAT and NeoPixels

Installation

The recommended way to install go-rpi-ws281x is:

go get github.com/mcuadros/go-rpi-ws281x
cd $GOPATH/src/github.com/mcuadros/go-rpi-ws281x/vendor/rpi_ws281x
scons

Requires having install golang and scons (on raspbian, apt-get install scons).

Examples

// create a new canvas with the given width and height, and the config, in this
// case the configuration is for a Unicorn pHAT (8x4 pixels matrix) with the
// default configuration
c, _ := ws281x.NewCanvas(8, 4, &ws281x.DefaultConfig)


// initialize the canvas and the matrix
c.Initialize()

// since ws281x implements image.Image any function like draw.Draw from the std
// library may be used with it.
// 
// now we copy a white image into the ws281x.Canvas, this turn on all the leds
// to white
draw.Draw(c, c.Bounds(), image.NewUniform(color.White), image.ZP, draw.Over)

// render and sleep to see the leds on
c.Render()
time.Sleep(time.Second * 5)

// don't forget close the canvas, if not you leds may remain on
c.Close()

Check the folder examples folder for more examples

License

MIT, see LICENSE

go-rpi-ws281x's People

Contributors

mcuadros avatar ssankauskas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

go-rpi-ws281x's Issues

No such file or directory: ws2811.h

Hey @mcuadros,
I'm trying to use your module to get my led matrix attached to a rpi zero w running with golang.

Unfortunatly I run into this error when I run go get github.com/mcuadros/go-rpi-ws281x:

# github.com/mcuadros/go-rpi-ws281x
../go/pkg/mod/github.com/mcuadros/[email protected]/matrix.go:8:10: fatal error: ws2811.h: No such file or directory
 #include <ws2811.h>
          ^~~~~~~~~~
compilation terminated.

golang and scons are installed.

Would be nice if you could push me in the right direction to solve this issue. ๐Ÿ‘

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.