big time risk
This commit is contained in:
5
main.go
5
main.go
@@ -69,10 +69,13 @@ func main() {
|
||||
m, err := rgbmatrix.NewRGBLedMatrix(config)
|
||||
fatal(err)
|
||||
mqMessages := make(chan mqtt.Message)
|
||||
log.Println("making listener")
|
||||
go listener(mqMessages)
|
||||
tk := rgbmatrix.NewToolKit(m)
|
||||
defer tk.Close()
|
||||
log.Println("making animator")
|
||||
go animator(tk, mqMessages)
|
||||
log.Println("I guess I'm at the end")
|
||||
}
|
||||
|
||||
func listener(mqMessages chan mqtt.Message) {
|
||||
@@ -83,6 +86,7 @@ func listener(mqMessages chan mqtt.Message) {
|
||||
log.Println(fmt.Sprintf("failed to connect to mq: %s", token.Error().Error()))
|
||||
panic(token.Error())
|
||||
}
|
||||
log.Println("connected")
|
||||
client.Subscribe(topic, 0, func(client mqtt.Client, msg mqtt.Message) {
|
||||
log.Println("Receiving ", string(msg.Payload()), " on topic: ", msg.Topic())
|
||||
mqMessages <- msg
|
||||
@@ -90,7 +94,6 @@ func listener(mqMessages chan mqtt.Message) {
|
||||
}
|
||||
|
||||
func animator(tk *rgbmatrix.ToolKit, mqMessages chan mqtt.Message) {
|
||||
|
||||
tk.PlayAnimation(NewAnimation(image.Point{64, 32}, mqMessages))
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user