From 3c6a8b143b01403deae5f8d4b32ff6b8cb0bb3c8 Mon Sep 17 00:00:00 2001 From: Martin Ashby Date: Mon, 21 May 2018 10:28:17 +0100 Subject: Added unicorn lib documentation and sample code --- Server.go | 4 ++-- unicorn/README.md | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 unicorn/README.md 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 -- cgit v1.2.3-ZIG From c0e52f380c0a06ccd87630ea4231c66b5976fe01 Mon Sep 17 00:00:00 2001 From: MFAshby Date: Mon, 21 May 2018 10:32:03 +0100 Subject: spelling --- unicorn/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unicorn/README.md b/unicorn/README.md index 9db2a3e..9e3d13a 100644 --- a/unicorn/README.md +++ b/unicorn/README.md @@ -1,4 +1,4 @@ -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 +A go library for interacting with Raspberry Pi Unicorn HAT HD, with a similar API to the official library https://github.com/pimoroni/unicorn-hat-hd Includes a simulator when running on amd64 and 386 linux PCs. @@ -21,4 +21,4 @@ func main() { uni.Show() uni.MainLoop() } -``` \ No newline at end of file +``` -- cgit v1.2.3-ZIG