-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.go
78 lines (71 loc) · 1.44 KB
/
test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package main
import (
"fmt"
"github.com/depili/go-rgb-led-matrix/bdf"
"github.com/depili/go-rgb-led-matrix/matrix"
"time"
)
func main() {
font, err := bdf.Parse("fonts/7x13B.bdf")
if err != nil {
panic(err)
}
fmt.Printf("Font loaded: %d chars\n", font.Chars)
glyph := font.GetGlyph(rune(65))
fmt.Printf("A: height: %d len: %d\n", glyph.Height, len(glyph.Bitmap))
for _, row := range glyph.Bitmap {
for _, b := range row {
if b {
fmt.Printf("X")
} else {
fmt.Printf(" ")
}
}
fmt.Printf("\n")
}
text := "Testi ÄÖ"
bitmap := font.TextBitmap(text)
for _, row := range bitmap {
for _, b := range row {
if b {
fmt.Printf("X")
} else {
fmt.Printf(" ")
}
}
fmt.Printf("\n")
}
m := matrix.Init("tcp://192.168.0.30:5555", 32, 128)
defer m.Close()
var color [3]byte
color[0] = 0
color[1] = 255
color[2] = 0
m.Fill(color)
m.Send()
time.Sleep(500 * time.Millisecond)
color[0] = 255
color[2] = 255
m.Fill(matrix.ColorWhite())
m.Send()
time.Sleep(500 * time.Millisecond)
for i := 0; i < 1000; i++ {
m.PlasmaFill(i)
m.Send()
time.Sleep(10 * time.Millisecond)
}
scroll := "Jotain tässä scrollaa "
bitmap = font.TextBitmap(scroll)
for i := 0; i < 1000; i++ {
m.Fill(matrix.ColorBlack())
m.ScrollPlasma(bitmap, 5, 15, i, 80)
m.Send()
time.Sleep(10 * time.Millisecond)
}
m.InitFlame()
for i := 0; i < 1000; i++ {
m.FlameFill()
m.Send()
time.Sleep(10 * time.Millisecond)
}
}