aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ashby <martin@martin-laptop.lan>2018-05-21 10:28:17 +0100
committerMartin Ashby <martin@martin-laptop.lan>2018-05-21 10:28:17 +0100
commit3c6a8b143b01403deae5f8d4b32ff6b8cb0bb3c8 (patch)
treea4f6ccaf4aca494f1f37ed5cdf92de770df2c828
parent731f339144d657d8dece768690cc870769d16254 (diff)
downloadunicornpaint-3c6a8b143b01403deae5f8d4b32ff6b8cb0bb3c8.tar.gz
unicornpaint-3c6a8b143b01403deae5f8d4b32ff6b8cb0bb3c8.tar.bz2
unicornpaint-3c6a8b143b01403deae5f8d4b32ff6b8cb0bb3c8.tar.xz
unicornpaint-3c6a8b143b01403deae5f8d4b32ff6b8cb0bb3c8.zip
Added unicorn lib documentation and sample code
-rw-r--r--Server.go4
-rw-r--r--unicorn/README.md24
2 files changed, 26 insertions, 2 deletions
diff --git a/Server.go b/Server.go
index 38dd493..3592252 100644
--- a/Server.go
+++ b/Server.go
@@ -4,14 +4,14 @@ import (
"encoding/json"
"fmt"
- "github.com/gorilla/websocket"
- //"github.com/veandco/go-sdl2/sdl"
"io/ioutil"
"log"
"net/http"
"path"
"strings"
+ "github.com/gorilla/websocket"
+
"github.com/MFAshby/unicornpaint/unicorn"
)
diff --git a/unicorn/README.md b/unicorn/README.md
new file mode 100644
index 0000000..9db2a3e
--- /dev/null
+++ b/unicorn/README.md
@@ -0,0 +1,24 @@
+A go library for interacting with Raspberry Pi Unicorn HAT HD, with a cimilar API to the official library https://github.com/pimoroni/unicorn-hat-hd
+
+Includes a simulator when running on amd64 and 386 linux PCs.
+
+Sample usage:
+```
+package main
+
+import "github.com/MFAshby/unicornpaint/unicorn"
+
+func main() {
+ uni, _ := unicorn.GetUnicorn()
+ defer func() { uni.Off() }()
+ var x, r, y, g, b uint8
+ x = 10
+ y = 10
+ r = 255
+ g = 255
+ b = 255
+ uni.SetPixel(x, y, r, g, b)
+ uni.Show()
+ uni.MainLoop()
+}
+``` \ No newline at end of file