big time risk

pull/3/head
Nathan 2 years ago
parent 89a9e009be
commit acbd559436

@ -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))
}

Loading…
Cancel
Save