pull/3/head
Máximo Cuadros 8 years ago
parent 25d6719482
commit 53fa87a5d3

@ -0,0 +1,45 @@
package main
import (
"flag"
"image/color"
"github.com/mcuadros/go-rpi-rgb-led-matrix"
)
var (
rows = flag.Int("led-rows", 32, "number of rows supported")
chain = flag.Int("led-chain", 2, "number of displays daisy-chained")
brightness = flag.Int("brightness", 100, "brightness (0-100)")
)
func main() {
config := &rgbmatrix.DefaultConfig
config.Rows = *rows
config.ChainLength = *chain
config.Brightness = *brightness
m, err := rgbmatrix.NewRGBLedMatrix(config)
fatal(err)
c := rgbmatrix.NewCanvas(m)
defer c.Close()
bounds := c.Bounds()
for x := bounds.Min.X; x < bounds.Max.X; x++ {
for y := bounds.Min.Y; y < bounds.Max.Y; y++ {
c.Set(x, y, color.RGBA{255, 0, 0, 255})
c.Render()
}
}
}
func init() {
flag.Parse()
}
func fatal(err error) {
if err != nil {
panic(err)
}
}

@ -0,0 +1,48 @@
package main
import (
"flag"
"os"
"time"
"github.com/mcuadros/go-rpi-rgb-led-matrix"
)
var (
rows = flag.Int("led-rows", 32, "number of rows supported")
chain = flag.Int("led-chain", 2, "number of displays daisy-chained")
brightness = flag.Int("brightness", 100, "brightness (0-100)")
image = flag.String("image", "", "image path")
)
func main() {
f, err := os.Open(*image)
fatal(err)
config := &rgbmatrix.DefaultConfig
config.Rows = *rows
config.ChainLength = *chain
config.Brightness = *brightness
m, err := rgbmatrix.NewRGBLedMatrix(config)
fatal(err)
tk := rgbmatrix.NewToolKit(m)
defer tk.Close()
close, err := tk.PlayGIF(f)
fatal(err)
time.Sleep(time.Second * 30)
close <- true
}
func init() {
flag.Parse()
}
func fatal(err error) {
if err != nil {
panic(err)
}
}

@ -0,0 +1,42 @@
package main
import (
"flag"
"os"
"time"
"github.com/mcuadros/go-rpi-rgb-led-matrix"
"github.com/mcuadros/go-rpi-rgb-led-matrix/rpc"
)
var (
img = flag.String("image", "", "image path")
)
func main() {
f, err := os.Open(*img)
fatal(err)
m, err := rpc.NewClient("tcp", "10.20.20.20:1234")
fatal(err)
c := rgbmatrix.NewCanvas(m)
defer c.Close()
tk := &rgbmatrix.ToolKit{c}
close, err := tk.PlayGIF(f)
fatal(err)
time.Sleep(time.Second * 3)
close <- true
}
func init() {
flag.Parse()
}
func fatal(err error) {
if err != nil {
panic(err)
}
}

@ -0,0 +1,32 @@
package main
import (
"flag"
"github.com/mcuadros/go-rpi-rgb-led-matrix"
"github.com/mcuadros/go-rpi-rgb-led-matrix/rpc"
)
var (
rows = flag.Int("led-rows", 32, "number of rows supported")
chain = flag.Int("led-chain", 2, "number of displays daisy-chained")
brightness = flag.Int("brightness", 100, "brightness (0-100)")
)
func main() {
config := &rgbmatrix.DefaultConfig
config.Rows = *rows
config.ChainLength = *chain
config.Brightness = *brightness
m, err := rgbmatrix.NewRGBLedMatrix(config)
fatal(err)
rpc.Serve(m)
}
func fatal(err error) {
if err != nil {
panic(err)
}
}
Loading…
Cancel
Save