Matrix/main.go

39 lines
957 B
Go

package main
import (
"log"
"github.com/go-resty/resty/v2"
"github.com/joho/godotenv"
)
func main() {
// Load .env file if it exists
err := godotenv.Load(".env")
if err != nil {
log.Fatal("Error loading .env file")
}
// Load env server data
url, width, height := loadMatrixData()
log.Printf("At '%s': %d x %d\n", url, width, height)
// Initialize resty client
client := resty.New()
// Initialize custom matrix data
col := Color{R: 255, G: 0, B: 255, Endpoint: COLOR}
rct := Rectangle{X: 0, Y: 0, W: 10, H: 10, Endpoint: RECTANGLE}
// Send request to remote server
sendRequest(client, url, []interface{}{col, rct})
// Initialize custom matrix data
col = Color{R: 255, G: 255, B: 0, Endpoint: COLOR}
rct = Rectangle{X: 15, Y: 15, W: 15, H: 15, Endpoint: RECTANGLE}
upd := Update{Endpoint: UPDATE}
// Send request to remote server
sendRequest(client, url, []interface{}{col, rct, upd})
}