-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (33 loc) · 1015 Bytes
/
main.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
package main
import (
"fmt"
"time"
"github.com/karalabe/hid"
"github.com/redtoad/go-dcled"
)
func main() {
var list = hid.Enumerate(dcled.VendorID, dcled.ProductID)
if len(list) == 0 {
println("Could not find USB device! Is it plugged in?")
return
}
// Use first device
device, err := list[0].Open()
if err != nil {
panic(err)
}
println(fmt.Sprintf("Connected to %s %s", device.Manufacturer, device.Product))
grid := [][]int{
{1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
{1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
{1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
{1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1},
{0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0},
}
for {
_ = dcled.DisplayGrid(grid, device)
time.Sleep(dcled.MinimumRefreshRate)
}
}