• Stars
    star
    80
  • Rank 390,184 (Top 8 %)
  • Language
    Go
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Go binding for rpi-rgb-led-matrix an excellent C++ library to control RGB LED displays with Raspberry Pi GPIO.

go-rpi-rgb-led-matrix GoDoc Build Status

Go binding for rpi-rgb-led-matrix an excellent C++ library to control RGB LED displays with Raspberry Pi GPIO.

This library includes the basic bindings to control de LED Matrix directly and also a convenient ToolKit with more high level functions. Also some examples are included to test the library and the configuration.

The Canvas struct implements the image.Image interface from the Go standard library. This makes the interaction with the matrix simple as work with a normal image in Go, allowing the usage of any Go library build around the image.Image interface.

To learn about the configuration and the wiring go to the original library, is highly detailed and well explained.

Installation

The recommended way to install go-rpi-rgb-led-matrix is:

go get github.com/mcuadros/go-rpi-rgb-led-matrix

Then you will get an expected error like this:

# github.com/mcuadros/go-rpi-rgb-led-matrix
/usr/bin/ld: cannot find -lrgbmatrix
collect2: error: ld returned 1 exit status

This happens because you need to compile the rgbmatrix C bindings:

cd $GOPATH/src/github.com/mcuadros/go-rpi-rgb-led-matrix/vendor/rpi-rgb-led-matrix/
git submodule update --init
make
cd $GOPATH/src/github.com/mcuadros/go-rpi-rgb-led-matrix/
go install -v ./...

Examples

Setting all the pixels to white:

// create a new Matrix instance with the DefaultConfig
m, _ := rgbmatrix.NewRGBLedMatrix(&rgbmatrix.DefaultConfig)

// create the Canvas, implements the image.Image interface
c := rgbmatrix.NewCanvas(m)
defer c.Close() // don't forgot close the Matrix, if not your leds will remain on
 
// using the standard draw.Draw function we copy a white image onto the Canvas
draw.Draw(c, c.Bounds(), &image.Uniform{color.White}, image.ZP, draw.Src)

// don't forget call Render to display the new led status
c.Render()

Playing a GIF into your matrix during 30 seconds:

// create a new Matrix instance with the DefaultConfig
m, _ := rgbmatrix.NewRGBLedMatrix(&rgbmatrix.DefaultConfig)

// create a ToolKit instance
tk := rgbmatrix.NewToolKit(m)
defer tk.Close() // don't forgot close the Matrix, if not your leds will remain on

// open the gif file for reading
file, _ := os.Open("mario.gif")

// play of the gif using the io.Reader
close, _ := tk.PlayGIF(f)
fatal(err)

// we wait 30 seconds and then we stop the playing gif sending a True to the returned chan
time.Sleep(time.Second * 30)
close <- true

The image of the header was recorded using this few lines, the running Mario gif, and three 32x64 pannels.

Check the folder examples folder for more examples

Matrix Emulation

As part of the library an small Matrix emulator is provided. The emulator renderize a virtual RGB matrix on a window in your desktop, without needing a real RGB matrix connected to your computer.

To execute the emulator set the MATRIX_EMULATOR environment variable to 1, then when NewRGBLedMatrix is used, a emulator.Emulator is returned instead of a interface the real board.

License

MIT, see LICENSE

More Repositories

1

ofelia

A docker job scheduler (aka. crontab for docker)
Go
2,777
star
2

go-syslog

Syslog server library for go.
Go
508
star
3

go-candyjs

fully transparent bridge between Go and the JavaScript
Go
455
star
4

dockership

dead simple docker deploy tool
Go
302
star
5

go-defaults

Go structures with default values using tags
Go
263
star
6

OctoPrint-TFT

A OctoPrint touch interface for TFT touch modules based on GTK+3
Go
171
star
7

go-version

Version normalizer and comparison library for go
Go
138
star
8

go-jsonschema-generator

json-schemas generator based on Go types
Go
117
star
9

ascode

AsCode - Terraform Alternative Syntax
Go
111
star
10

homebrew-hhvm

HHVM repository for Homebrew
Ruby
104
star
11

pynats

[Abandoned] A Python client for the NATS messaging system.
Python
75
star
12

gce-docker

Google Cloud Engine integration for Docker
Go
59
star
13

go-rpi-ws281x

Go bindings for Raspberry Pi PWM library for WS281X LEDs
Go
41
star
14

go-lookup

Small library on top of reflect for make lookups to any Structs or Maps
Go
37
star
15

go-monitor

a simple and extensible way to build monitorizable go process via HTTP.
Go
32
star
16

rocketizer

[Abandoned] Painless Dockerfile transformation to Rocket containers
Go
28
star
17

go-stable

Golang fixed versions tool for your private and public dependencies
Go
23
star
18

passage

SSH tunnels on steroids
Go
22
star
19

go-crxmake

CRX Package generator
Go
19
star
20

currency-detector

Class to detect the currency from any string
PHP
19
star
21

go-rat

tar extension for random access
Go
19
star
22

php-cayley

PHP wrapper of the Google's Cayley graph database REST interface
PHP
18
star
23

go-octoprint

Go library for accessing the OctoPrint's REST API
Go
17
star
24

go-composer

Basic replacement of Composer, the Dependency Manager for PHP
Go
16
star
25

harvester

Harvesterd is a low footprint collector and parser for events and logs
Go
12
star
26

fabric-composer

Deploy system for PHP composer based projects made with Fabric
Python
11
star
27

silex-hateoas

A RESTful example based on Hateoas and Silex
PHP
8
star
28

lemondb

Extensible MongoDB proxy
Go
8
star
29

go-git-aerospike

Example of go-git backed by a Aerospike
Go
7
star
30

go-raa

fast random access filesystem archive
Go
5
star
31

pimple-hack

A Pimple version in Hack/HHVM, just for fun!
PHP
4
star
32

python-solid-example

Simple example implementing SOLID principles with Python
Python
4
star
33

go-etcd-hydrator

Go
4
star
34

bson-hni

C++
3
star
35

pgwire

Go
3
star
36

ansi-slides

Slide with ANSI style!
PHP
3
star
37

go-time-aggregator

Go
3
star
38

bson-php-cpp

Libbson + PHP-CPP
C++
2
star
39

go-personal

A tiny library to score strings as fullnames or emails.
Go
2
star
40

go-mgo-cache

MongoDB interface for a Go cache
Go
2
star
41

dotfiles

Coming back to Linux! My new config files.
C
2
star
42

golang-arm

Docker Image packaging for golang for ARM platforms.
Shell
2
star
43

dockership-site

Dockership documentation
HTML
1
star
44

natstress

A stress tool for NATS Servers
Go
1
star
45

yCrawler

PHP
1
star
46

cli-array-editor

This class provides an easy way to edit arrays in CLI using vim or your preferred editor.
PHP
1
star
47

statsd-ducksboard-backend

A StatsD backend that sends metrics to Ducksboard
JavaScript
1
star
48

docker-arm

Dockerfiles for ARM
Shell
1
star
49

presentations

Repository of presentations
1
star
50

go-bson-schema

Go
1
star