├── .gitignore ├── README.md ├── cheerlights ├── .gitignore ├── Dockerfile ├── Dockerfile.old ├── README.md ├── app.go └── cheerlights.go ├── cputemp ├── .gitignore ├── README.md └── app.go ├── jsonclient ├── .gitignore ├── app.go └── sample.json ├── progress ├── Dockerfile ├── README.md └── app.go ├── random_blink ├── .gitignore ├── Dockerfile ├── README.md └── app.go ├── random_blink_colours ├── .gitignore ├── Dockerfile ├── README.md └── app.go ├── resistor_clock ├── .gitignore ├── Dockerfile ├── README.md └── app.go ├── solid_colours ├── .gitignore ├── Dockerfile ├── README.md └── app.go ├── solid_colours_brightness ├── .gitignore ├── Dockerfile ├── README.md └── app.go ├── spacecount ├── .gitignore ├── Dockerfile ├── README.md ├── app.go └── space.go └── sysfs ├── cheerlights ├── .gitignore ├── README.md ├── app.go └── cheerlights.go ├── progress ├── .gitignore ├── Dockerfile ├── Dockerfile.build ├── README.md ├── app.go └── build.sh ├── redis_sender ├── Dockerfile ├── Dockerfile.build ├── app.go └── build.sh └── redis_view ├── .gitignore ├── Dockerfile ├── Dockerfile.build ├── README.md ├── app.go └── build.sh /.gitignore: -------------------------------------------------------------------------------- 1 | sysfs/redis_sender/redis_sender 2 | progress/progress 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # blinkt_go_examples 2 | 3 | These examples go with the [Blinkt_go library](https://github.com/alexellis/blinkt_go/) 4 | 5 | The [Pimoroni Blinkt!](https://shop.pimoroni.com/products/blinkt) is an 8x RGB LED add-on for the Raspberry Pi. 6 | 7 | Running one of the examples: 8 | 9 | ``` 10 | export GOPATH=$HOME/go/ 11 | mkdir -p /home/pi/go/src/github.com/alexellis/ 12 | git clone https://github.com/alexellis/blinkt_go_examples 13 | 14 | cd progress 15 | go get 16 | sudo -E go run app.go 17 | ``` 18 | 19 | The Pimoroni Python examples are available here: 20 | 21 | https://github.com/pimoroni/blinkt/tree/master/examples 22 | 23 | PRs are welcome to port examples across to Go. 24 | 25 | ![](https://cdn.shopify.com/s/files/1/0174/1800/products/Blinkt_-_Zero-2_1024x1024.JPG?v=1466525645) 26 | -------------------------------------------------------------------------------- /cheerlights/.gitignore: -------------------------------------------------------------------------------- 1 | cheerlights 2 | -------------------------------------------------------------------------------- /cheerlights/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alexellis2/go-armhf:1.9 as build 2 | 3 | # Official image only works on RPi2/3 due to Docker issue with official images. 4 | # FROM golang:1.9.2 as build 5 | RUN apk add --no-cache git 6 | 7 | ENV GOPATH=/go 8 | RUN go get -d -u github.com/alexellis/blinkt_go/sysfs/gpio 9 | 10 | RUN mkdir -p /go/src/github.com/alexellis/blink_go_examples/example 11 | WORKDIR /go/src/github.com/alexellis/blinkt_go_examples/example 12 | 13 | COPY . . 14 | 15 | RUN GOARM=6 CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /usr/bin/app . 16 | 17 | FROM scratch 18 | 19 | COPY --from=build /usr/bin/app /app 20 | 21 | CMD ["/app"] 22 | -------------------------------------------------------------------------------- /cheerlights/Dockerfile.old: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian 2 | 3 | # Install Go 1.7.5 and enough of a build-chain to build wiringpi (in C) 4 | RUN apt-get update && \ 5 | apt-get install -qy \ 6 | --no-install-recommends build-essential wiringpi git curl ca-certificates && \ 7 | curl -sSLO https://storage.googleapis.com/golang/go1.7.5.linux-armv6l.tar.gz && \ 8 | mkdir -p /usr/local/go && \ 9 | tar -xvf go1.7.5.linux-armv6l.tar.gz -C /usr/local/go/ --strip-components=1 10 | 11 | ENV PATH=$PATH:/usr/local/go/bin/ 12 | ENV GOPATH=/go/ 13 | 14 | RUN mkdir -p /go/src/github.com/alexellis/blinkt_go_examples/cheerlights 15 | WORKDIR /go/src/github.com/alexellis/blinkt_go_examples/cheerlights 16 | 17 | COPY app.go cheerlights.go ./ 18 | RUN go get -d -v 19 | 20 | RUN go build -o /usr/bin/cheerlights 21 | 22 | FROM resin/rpi-raspbian 23 | WORKDIR /root/ 24 | COPY --from=0 /usr/bin/cheerlights /root/cheerlights 25 | 26 | CMD ["./cheerlights"] 27 | -------------------------------------------------------------------------------- /cheerlights/README.md: -------------------------------------------------------------------------------- 1 | ## Cheerlights 2 | 3 | Changes all the LEDs to the colour specified by the Cheerlights IoT feed. Tweet #cheerlights 4 | 5 | -------------------------------------------------------------------------------- /cheerlights/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | "strconv" 6 | 7 | . "github.com/alexellis/blinkt_go/sysfs" 8 | ) 9 | 10 | func getEnv(envVar string, assumed int) int { 11 | if value, exists := os.LookupEnv(envVar); exists { 12 | if period, err := strconv.Atoi(value); err == nil { 13 | return period 14 | } 15 | } 16 | return assumed 17 | } 18 | 19 | const defaultRefreshSeconds = 60 20 | const envRefreshSeconds = "refresh_seconds" 21 | 22 | func main() { 23 | 24 | brightness := 0.5 25 | blinkt := NewBlinkt(brightness) 26 | 27 | checkPeriodSeconds := getEnv(envRefreshSeconds, defaultRefreshSeconds) 28 | 29 | blinkt.SetClearOnExit(true) 30 | 31 | blinkt.Setup() 32 | 33 | Delay(100) 34 | 35 | for { 36 | 37 | r, g, b := getCheerlightColours() 38 | 39 | blinkt.Clear() 40 | blinkt.SetAll(r, g, b) 41 | blinkt.Show() 42 | Delay(checkPeriodSeconds * 1000) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /cheerlights/cheerlights.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "encoding/hex" 5 | "encoding/json" 6 | "io/ioutil" 7 | "log" 8 | "net/http" 9 | "strings" 10 | "time" 11 | ) 12 | 13 | type cheerlight struct { 14 | Colour string `json:"field2"` 15 | } 16 | 17 | func getRGBFromColour(hexString string) (int, int, int) { 18 | //strip off the hash and decode the remaining hex value 19 | hexCol, _ := hex.DecodeString(strings.TrimPrefix(hexString, "#")) 20 | //return the ints representing rgb 21 | return int(hexCol[0]), int(hexCol[1]), int(hexCol[2]) 22 | } 23 | 24 | func getCheerlightColours() (int, int, int) { 25 | var netClient = &http.Client{ 26 | Timeout: time.Second * 3, 27 | } 28 | resp, getErr := netClient.Get("http://api.thingspeak.com/channels/1417/field/2/last.json") 29 | 30 | if getErr != nil { 31 | log.Panic(getErr) 32 | } 33 | 34 | if resp.Body != nil { 35 | defer resp.Body.Close() 36 | } 37 | 38 | body, readErr := ioutil.ReadAll(resp.Body) 39 | 40 | if readErr != nil { 41 | log.Panic(getErr) 42 | } 43 | 44 | result := cheerlight{} 45 | 46 | parseErr := json.Unmarshal(body, &result) 47 | if parseErr != nil { 48 | log.Panic("Can't parse response") 49 | return 0, 0, 0 50 | } 51 | 52 | return getRGBFromColour(result.Colour) 53 | 54 | } 55 | -------------------------------------------------------------------------------- /cputemp/.gitignore: -------------------------------------------------------------------------------- 1 | cputemp 2 | -------------------------------------------------------------------------------- /cputemp/README.md: -------------------------------------------------------------------------------- 1 | ## cputemp 2 | 3 | A port of the Python example `cpu_temp` by Pimoroni. 4 | 5 | 6 | -------------------------------------------------------------------------------- /cputemp/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "os/exec" 7 | "strconv" 8 | "strings" 9 | 10 | . "github.com/alexellis/blinkt_go" 11 | ) 12 | 13 | func getTemperature() float64 { 14 | targetCmd := exec.Command("vcgencmd", "measure_temp") 15 | var out bytes.Buffer 16 | targetCmd.Stdout = &out 17 | err := targetCmd.Run() 18 | if err != nil { 19 | fmt.Println(err) 20 | } 21 | temp := out.String() 22 | 23 | //temp=35.8'C 24 | tempVal := temp[strings.Index(temp, "=")+1 : len(temp)-3] 25 | celcius, _ := strconv.ParseFloat(tempVal, 64) 26 | return celcius 27 | } 28 | 29 | func min(x float64, y float64) float64 { 30 | if x < y { 31 | return x 32 | } 33 | return y 34 | } 35 | 36 | func showGraph(bl *Blinkt, v float64, r int, g int, b int) { 37 | v = v * 8 38 | one := float64(1.0) 39 | 40 | for i := 0; i < 8; i++ { 41 | if v < 0 { 42 | r, g, b = 0, 0, 0 43 | } else { 44 | r = int(float64(r) * min(v, one)) 45 | g = int(float64(g) * min(v, one)) 46 | b = int(float64(b) * min(v, one)) 47 | } 48 | bl.SetPixel(i, r, g, b) 49 | v = v - 1 50 | } 51 | bl.Show() 52 | } 53 | 54 | func main() { 55 | brightness := 0.5 56 | blinkt := NewBlinkt(brightness) 57 | blinkt.Setup() 58 | blinkt.SetClearOnExit(true) 59 | 60 | for { 61 | celcius := getTemperature() 62 | fmt.Printf("Temperature: %2.2f\n", celcius) 63 | 64 | v := celcius / 100 65 | showGraph(&blinkt, v, 255, 255, 255) 66 | Delay(5000) 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /jsonclient/.gitignore: -------------------------------------------------------------------------------- 1 | jsonclient 2 | 3 | -------------------------------------------------------------------------------- /jsonclient/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "encoding/json" 4 | import "net/http" 5 | import "io/ioutil" 6 | import "log" 7 | import "time" 8 | 9 | type People struct { 10 | Number int `json:"number"` 11 | 12 | } 13 | 14 | func main() { 15 | var netClient = &http.Client{ 16 | Timeout: time.Second * 3, 17 | } 18 | resp, getErr := netClient.Get("http://api.open-notify.org/astros.json") 19 | if getErr != nil { 20 | log.Panic(getErr) 21 | } 22 | body, readErr := ioutil.ReadAll(resp.Body) 23 | if readErr != nil { 24 | log.Panic(getErr) 25 | } 26 | 27 | var people People 28 | parseErr := json.Unmarshal(body, &people) 29 | if parseErr !=nil { 30 | log.Panic("Can't parse response") 31 | return 32 | } 33 | log.Println(string(body)) 34 | log.Printf("People: %d", people.Number) 35 | } 36 | -------------------------------------------------------------------------------- /jsonclient/sample.json: -------------------------------------------------------------------------------- 1 | {"people": [{"craft": "ISS", "name": "Sergey Rizhikov"}, {"craft": "ISS", "name": "Andrey Borisenko"}, {"craft": "ISS", "name": "Shane Kimbrough"}, {"craft": "ISS", "name": "Oleg Novitskiy"}, {"craft": "ISS", "name": "Thomas Pesquet"}, {"craft": "ISS", "name": "Peggy Whitson"}], "message": "success", "number": 6} 2 | -------------------------------------------------------------------------------- /progress/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian 2 | 3 | # Install Go 1.7.5 and enough of a build-chain to build wiringpi (in C) 4 | RUN apt-get update && \ 5 | apt-get install -qy build-essential wiringpi git curl ca-certificates && \ 6 | curl -sSLO https://storage.googleapis.com/golang/go1.7.5.linux-armv6l.tar.gz && \ 7 | mkdir -p /usr/local/go && \ 8 | tar -xvf go1.7.5.linux-armv6l.tar.gz -C /usr/local/go/ --strip-components=1 9 | 10 | ENV PATH=$PATH:/usr/local/go/bin/ 11 | ENV GOPATH=/go/ 12 | 13 | RUN mkdir -p /go/src/github.com/alexellis/blinkt_go_examples/progress 14 | WORKDIR /go/src/github.com/alexellis/blinkt_go_examples/progress 15 | 16 | COPY app.go . 17 | RUN go get -d -v 18 | 19 | RUN go build 20 | 21 | CMD ["./progress"] 22 | -------------------------------------------------------------------------------- /progress/README.md: -------------------------------------------------------------------------------- 1 | ## `progress` example 2 | 3 | A red line loops from left to right like a progress bar. 4 | -------------------------------------------------------------------------------- /progress/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import . "github.com/alexellis/blinkt_go" 4 | 5 | func main() { 6 | brightness := 0.5 7 | blinkt := NewBlinkt(brightness) 8 | 9 | blinkt.SetClearOnExit(true) 10 | 11 | blinkt.Setup() 12 | 13 | Delay(100) 14 | 15 | r := 150 16 | g := 0 17 | b := 0 18 | for { 19 | for pixel := 0; pixel < 8; pixel++ { 20 | blinkt.Clear() 21 | blinkt.SetPixel(pixel, r, g, b) 22 | blinkt.Show() 23 | Delay(100) 24 | } 25 | for pixel := 7; pixel > 0; pixel-- { 26 | blinkt.Clear() 27 | blinkt.SetPixel(pixel, r, g, b) 28 | blinkt.Show() 29 | Delay(100) 30 | } 31 | } 32 | blinkt.Clear() 33 | blinkt.Show() 34 | } 35 | -------------------------------------------------------------------------------- /random_blink/.gitignore: -------------------------------------------------------------------------------- 1 | random_blink -------------------------------------------------------------------------------- /random_blink/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian 2 | 3 | # Install Go 1.7.5 and enough of a build-chain to build wiringpi (in C) 4 | RUN apt-get update && \ 5 | apt-get install -qy build-essential wiringpi git curl ca-certificates && \ 6 | curl -sSLO https://storage.googleapis.com/golang/go1.7.5.linux-armv6l.tar.gz && \ 7 | mkdir -p /usr/local/go && \ 8 | tar -xvf go1.7.5.linux-armv6l.tar.gz -C /usr/local/go/ --strip-components=1 9 | 10 | ENV PATH=$PATH:/usr/local/go/bin/ 11 | ENV GOPATH=/go/ 12 | 13 | RUN mkdir -p /go/src/github.com/alexellis/blinkt_go_examples/random_blink 14 | WORKDIR /go/src/github.com/alexellis/blinkt_go_examples/random_blink 15 | 16 | COPY app.go . 17 | RUN go get -d -v 18 | 19 | RUN go build 20 | 21 | CMD ["./random_blink"] 22 | -------------------------------------------------------------------------------- /random_blink/README.md: -------------------------------------------------------------------------------- 1 | ## random_blink 2 | 3 | A port of the Python example `random_blink` by Pimoroni. -------------------------------------------------------------------------------- /random_blink/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "math/rand" 5 | "time" 6 | 7 | . "github.com/alexellis/blinkt_go" 8 | ) 9 | 10 | func shuffleAndSlice(arr []int) []int { 11 | 12 | t := time.Now() 13 | rand.Seed(int64(t.Nanosecond())) 14 | 15 | for i := len(arr) - 1; i > 0; i-- { 16 | j := rand.Intn(i) 17 | arr[i], arr[j] = arr[j], arr[i] 18 | } 19 | 20 | subsetSize := rand.Intn(5) + 1 // +1 as zero based 21 | return arr[:subsetSize] 22 | } 23 | 24 | func isIn(s *[]int, e *int) bool { 25 | for _, a := range *s { 26 | if a == *e { 27 | return true 28 | } 29 | } 30 | return false 31 | } 32 | 33 | func main() { 34 | 35 | brightness := 0.5 36 | blinkt := NewBlinkt(brightness) 37 | 38 | blinkt.SetClearOnExit(true) 39 | 40 | blinkt.Setup() 41 | 42 | Delay(100) 43 | 44 | nums := []int{0, 1, 2, 3, 4, 5, 6, 7} 45 | 46 | for { 47 | 48 | //There must be a more elegant way of doing this 49 | pixels := shuffleAndSlice(nums) 50 | for _, i := range nums { 51 | if isIn(&pixels, &i) { 52 | blinkt.SetPixel(i, 255, 150, 0) 53 | } else { 54 | blinkt.SetPixel(i, 0, 0, 0) 55 | } 56 | } 57 | 58 | blinkt.Show() 59 | Delay(50) 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /random_blink_colours/.gitignore: -------------------------------------------------------------------------------- 1 | random_blink_colours -------------------------------------------------------------------------------- /random_blink_colours/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian 2 | 3 | # Install Go 1.7.5 and enough of a build-chain to build wiringpi (in C) 4 | RUN apt-get update && \ 5 | apt-get install -qy build-essential wiringpi git curl ca-certificates && \ 6 | curl -sSLO https://storage.googleapis.com/golang/go1.7.5.linux-armv6l.tar.gz && \ 7 | mkdir -p /usr/local/go && \ 8 | tar -xvf go1.7.5.linux-armv6l.tar.gz -C /usr/local/go/ --strip-components=1 9 | 10 | ENV PATH=$PATH:/usr/local/go/bin/ 11 | ENV GOPATH=/go/ 12 | 13 | RUN mkdir -p /go/src/github.com/alexellis/blinkt_go_examples/random_blink_colours 14 | WORKDIR /go/src/github.com/alexellis/blinkt_go_examples/random_blink_colours 15 | 16 | COPY app.go . 17 | RUN go get -d -v 18 | 19 | RUN go build 20 | 21 | CMD ["./random_blink_colours"] 22 | -------------------------------------------------------------------------------- /random_blink_colours/README.md: -------------------------------------------------------------------------------- 1 | ## random_blink_colours 2 | 3 | A port of the Python example `random_blink_colours` by Pimoroni. -------------------------------------------------------------------------------- /random_blink_colours/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "math/rand" 5 | 6 | . "github.com/alexellis/blinkt_go" 7 | ) 8 | 9 | func main() { 10 | 11 | brightness := 0.5 12 | blinkt := NewBlinkt(brightness) 13 | 14 | blinkt.SetClearOnExit(true) 15 | 16 | blinkt.Setup() 17 | 18 | Delay(100) 19 | 20 | for { 21 | 22 | for pixel := 0; pixel < 8; pixel++ { 23 | blinkt.SetPixel(pixel, rand.Intn(255), rand.Intn(255), rand.Intn(255)) 24 | } 25 | 26 | blinkt.Show() 27 | Delay(50) 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /resistor_clock/.gitignore: -------------------------------------------------------------------------------- 1 | resistor_clock -------------------------------------------------------------------------------- /resistor_clock/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian 2 | 3 | # Install Go 1.7.5 and enough of a build-chain to build wiringpi (in C) 4 | RUN apt-get update && \ 5 | apt-get install -qy build-essential wiringpi git curl ca-certificates && \ 6 | curl -sSLO https://storage.googleapis.com/golang/go1.7.5.linux-armv6l.tar.gz && \ 7 | mkdir -p /usr/local/go && \ 8 | tar -xvf go1.7.5.linux-armv6l.tar.gz -C /usr/local/go/ --strip-components=1 9 | 10 | ENV PATH=$PATH:/usr/local/go/bin/ 11 | ENV GOPATH=/go/ 12 | 13 | RUN mkdir -p /go/src/github.com/alexellis/blinkt_go_examples/resistor_clock 14 | WORKDIR /go/src/github.com/alexellis/blinkt_go_examples/resistor_clock 15 | 16 | COPY app.go . 17 | RUN go get -d -v 18 | 19 | RUN go build 20 | 21 | CMD ["./resistor_clock"] 22 | -------------------------------------------------------------------------------- /resistor_clock/README.md: -------------------------------------------------------------------------------- 1 | ## resistor_clock 2 | 3 | A port of the Python example `resistor_clock` by Pimoroni. -------------------------------------------------------------------------------- /resistor_clock/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "time" 5 | 6 | . "github.com/alexellis/blinkt_go" 7 | ) 8 | 9 | func breakOut(colours []int) (int, int, int) { 10 | r := colours[0] 11 | g := colours[1] 12 | b := colours[2] 13 | return r, g, b 14 | } 15 | 16 | func main() { 17 | 18 | brightness := 0.5 19 | blinkt := NewBlinkt(brightness) 20 | 21 | blinkt.SetClearOnExit(true) 22 | 23 | colours := [10][3]int{ 24 | {0, 0, 0}, //0 black 25 | {139, 69, 19}, //1 brown 26 | {255, 0, 0}, //2 red 27 | {255, 69, 0}, //3 orange 28 | {255, 255, 0}, //4 yellow 29 | {0, 255, 0}, //5 green 30 | {0, 0, 255}, //6 blue 31 | {128, 0, 128}, //7 violet 32 | {255, 255, 100}, //8 grey 33 | {255, 255, 255}, //9 white 34 | } 35 | 36 | blinkt.Setup() 37 | Delay(100) 38 | 39 | r := 0 40 | g := 0 41 | b := 0 42 | 43 | for { 44 | 45 | t := time.Now() 46 | hour := t.Hour() 47 | minute := t.Minute() 48 | 49 | hourten := hour / 10 50 | hourunit := hour % 10 51 | minuteten := minute / 10 52 | minuteunit := minute % 10 53 | 54 | r, g, b = breakOut(colours[hourten][:]) 55 | blinkt.SetPixel(0, r, g, b) 56 | blinkt.SetPixel(1, r, g, b) 57 | 58 | r, g, b = breakOut(colours[hourunit][:]) 59 | blinkt.SetPixel(2, r, g, b) 60 | blinkt.SetPixel(3, r, g, b) 61 | 62 | r, g, b = breakOut(colours[minuteten][:]) 63 | blinkt.SetPixel(4, r, g, b) 64 | blinkt.SetPixel(5, r, g, b) 65 | 66 | r, g, b = breakOut(colours[minuteunit][:]) 67 | blinkt.SetPixel(6, r, g, b) 68 | blinkt.SetPixel(7, r, g, b) 69 | 70 | blinkt.Show() 71 | Delay(500) 72 | 73 | blinkt.SetPixel(7, 0, 0, 0) 74 | 75 | blinkt.Show() 76 | Delay(500) 77 | 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /solid_colours/.gitignore: -------------------------------------------------------------------------------- 1 | solid_colours -------------------------------------------------------------------------------- /solid_colours/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian 2 | 3 | # Install Go 1.7.5 and enough of a build-chain to build wiringpi (in C) 4 | RUN apt-get update && \ 5 | apt-get install -qy build-essential wiringpi git curl ca-certificates && \ 6 | curl -sSLO https://storage.googleapis.com/golang/go1.7.5.linux-armv6l.tar.gz && \ 7 | mkdir -p /usr/local/go && \ 8 | tar -xvf go1.7.5.linux-armv6l.tar.gz -C /usr/local/go/ --strip-components=1 9 | 10 | ENV PATH=$PATH:/usr/local/go/bin/ 11 | ENV GOPATH=/go/ 12 | 13 | RUN mkdir -p /go/src/github.com/alexellis/blinkt_go_examples/solid_colours 14 | WORKDIR /go/src/github.com/alexellis/blinkt_go_examples/solid_colours 15 | 16 | COPY app.go . 17 | RUN go get -d -v 18 | 19 | RUN go build 20 | 21 | CMD ["./solid_colours"] 22 | -------------------------------------------------------------------------------- /solid_colours/README.md: -------------------------------------------------------------------------------- 1 | ## solid_colours 2 | 3 | A port of the Python example `solid_colours` by Pimoroni. -------------------------------------------------------------------------------- /solid_colours/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import . "github.com/alexellis/blinkt_go" 4 | 5 | func main() { 6 | 7 | brightness := 0.5 8 | blinkt := NewBlinkt(brightness) 9 | 10 | blinkt.SetClearOnExit(true) 11 | 12 | blinkt.Setup() 13 | 14 | Delay(100) 15 | 16 | step := 0 17 | 18 | for { 19 | 20 | step = step % 3 21 | switch step { 22 | case 0: 23 | blinkt.SetAll(128, 0, 0) 24 | case 1: 25 | blinkt.SetAll(0, 128, 0) 26 | case 2: 27 | blinkt.SetAll(0, 0, 128) 28 | } 29 | 30 | step++ 31 | blinkt.Show() 32 | Delay(500) 33 | 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /solid_colours_brightness/.gitignore: -------------------------------------------------------------------------------- 1 | solid_colours_brightness 2 | -------------------------------------------------------------------------------- /solid_colours_brightness/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian 2 | 3 | # Install Go 1.7.5 and enough of a build-chain to build wiringpi (in C) 4 | RUN apt-get update && \ 5 | apt-get install -qy build-essential wiringpi git curl ca-certificates && \ 6 | curl -sSLO https://storage.googleapis.com/golang/go1.7.5.linux-armv6l.tar.gz && \ 7 | mkdir -p /usr/local/go && \ 8 | tar -xvf go1.7.5.linux-armv6l.tar.gz -C /usr/local/go/ --strip-components=1 9 | 10 | ENV PATH=$PATH:/usr/local/go/bin/ 11 | ENV GOPATH=/go/ 12 | 13 | RUN mkdir -p /go/src/github.com/alexellis/blinkt_go_examples/solid_colours_brightness 14 | WORKDIR /go/src/github.com/alexellis/blinkt_go_examples/solid_colours_brightness 15 | 16 | COPY app.go . 17 | RUN go get -d -v 18 | 19 | RUN go build 20 | 21 | CMD ["./solid_colours_brightness"] 22 | -------------------------------------------------------------------------------- /solid_colours_brightness/README.md: -------------------------------------------------------------------------------- 1 | ## solid_colours_brightness 2 | 3 | An elaboration of the `solid_colours` example to demonstrate how to set brightness throughout runtime. -------------------------------------------------------------------------------- /solid_colours_brightness/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import . "github.com/alexellis/blinkt_go" 4 | 5 | func main() { 6 | 7 | brightness := 0.5 8 | blinkt := NewBlinkt(brightness) 9 | 10 | blinkt.SetClearOnExit(true) 11 | 12 | blinkt.Setup() 13 | 14 | Delay(100) 15 | 16 | step := 0 17 | 18 | for { 19 | 20 | step = step % 3 21 | switch step { 22 | case 0: 23 | blinkt.SetAll(128, 0, 0).SetBrightness(0.5) 24 | case 1: 25 | blinkt.SetBrightness(0.1).SetAll(0, 128, 0) 26 | case 2: 27 | blinkt.SetAll(0, 0, 128).SetBrightness(0.9) 28 | } 29 | 30 | step++ 31 | blinkt.Show() 32 | Delay(500) 33 | 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /spacecount/.gitignore: -------------------------------------------------------------------------------- 1 | spacecount 2 | -------------------------------------------------------------------------------- /spacecount/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian 2 | 3 | # Install Go 1.7.5 and enough of a build-chain to build wiringpi (in C) 4 | RUN apt-get update && \ 5 | apt-get install -qy build-essential wiringpi git curl ca-certificates && \ 6 | curl -sSLO https://storage.googleapis.com/golang/go1.7.5.linux-armv6l.tar.gz && \ 7 | mkdir -p /usr/local/go && \ 8 | tar -xvf go1.7.5.linux-armv6l.tar.gz -C /usr/local/go/ --strip-components=1 9 | 10 | ENV PATH=$PATH:/usr/local/go/bin/ 11 | ENV GOPATH=/go/ 12 | 13 | RUN mkdir -p /go/src/github.com/alexellis/blinkt_go_examples/spacecount 14 | WORKDIR /go/src/github.com/alexellis/blinkt_go_examples/spacecount 15 | 16 | COPY app.go space.go ./ 17 | RUN go get -d -v 18 | 19 | RUN go build 20 | 21 | CMD ["./spacecount"] 22 | -------------------------------------------------------------------------------- /spacecount/README.md: -------------------------------------------------------------------------------- 1 | ## Space count 2 | 3 | Counts how many people are in space and lights up N LEDs in red. 4 | 5 | -------------------------------------------------------------------------------- /spacecount/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import . "github.com/alexellis/blinkt_go" 4 | 5 | func main() { 6 | 7 | brightness := 0.5 8 | blinkt := NewBlinkt(brightness) 9 | 10 | checkPeriodSeconds := 60 11 | 12 | blinkt.SetClearOnExit(true) 13 | 14 | blinkt.Setup() 15 | 16 | Delay(100) 17 | 18 | for { 19 | num := getAstronautCount() 20 | 21 | r := 150 22 | g := 0 23 | b := 0 24 | blinkt.Clear() 25 | 26 | for pixel := 0; pixel < num; pixel++ { 27 | blinkt.SetPixel(pixel, r, g, b) 28 | blinkt.Show() 29 | Delay(100) 30 | } 31 | 32 | Delay(checkPeriodSeconds * 1000) 33 | } 34 | blinkt.Clear() 35 | blinkt.Show() 36 | } 37 | -------------------------------------------------------------------------------- /spacecount/space.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "encoding/json" 4 | import "net/http" 5 | import "io/ioutil" 6 | import "log" 7 | import "time" 8 | 9 | type People struct { 10 | Number int `json:"number"` 11 | 12 | } 13 | 14 | func getAstronautCount() int { 15 | var netClient = &http.Client{ 16 | Timeout: time.Second * 3, 17 | } 18 | resp, getErr := netClient.Get("http://api.open-notify.org/astros.json") 19 | if getErr != nil { 20 | log.Panic(getErr) 21 | } 22 | body, readErr := ioutil.ReadAll(resp.Body) 23 | if readErr != nil { 24 | log.Panic(getErr) 25 | } 26 | 27 | var people People 28 | parseErr := json.Unmarshal(body, &people) 29 | if parseErr !=nil { 30 | log.Panic("Can't parse response") 31 | return 0 32 | } 33 | 34 | return people.Number 35 | } 36 | -------------------------------------------------------------------------------- /sysfs/cheerlights/.gitignore: -------------------------------------------------------------------------------- 1 | cheerlights 2 | -------------------------------------------------------------------------------- /sysfs/cheerlights/README.md: -------------------------------------------------------------------------------- 1 | ## Cheerlights 2 | 3 | Changes all the LEDs to the colour specified by the Cheerlights IoT feed. Tweet #cheerlights 4 | 5 | This version of uses sysfs so it will work with Docker Swarm. 6 | -------------------------------------------------------------------------------- /sysfs/cheerlights/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import . "github.com/alexellis/blinkt_go/sysfs" 4 | 5 | func main() { 6 | 7 | brightness := 0.5 8 | blinkt := NewBlinkt(brightness) 9 | 10 | checkPeriodSeconds := 60 11 | 12 | blinkt.SetClearOnExit(true) 13 | 14 | blinkt.Setup() 15 | 16 | Delay(100) 17 | 18 | for { 19 | 20 | r, g, b := getCheerlightColours() 21 | 22 | blinkt.Clear() 23 | blinkt.SetAll(r, g, b) 24 | blinkt.Show() 25 | Delay(checkPeriodSeconds * 1000) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /sysfs/cheerlights/cheerlights.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "encoding/hex" 5 | "encoding/json" 6 | "io/ioutil" 7 | "log" 8 | "net/http" 9 | "strings" 10 | "time" 11 | ) 12 | 13 | type cheerlight struct { 14 | Colour string `json:"field2"` 15 | } 16 | 17 | func getRGBFromColour(hexString string) (int, int, int) { 18 | //strip off the hash and decode the remaining hex value 19 | hexCol, _ := hex.DecodeString(strings.TrimPrefix(hexString, "#")) 20 | //return the ints representing rgb 21 | return int(hexCol[0]), int(hexCol[1]), int(hexCol[2]) 22 | } 23 | 24 | func getCheerlightColours() (int, int, int) { 25 | var netClient = &http.Client{ 26 | Timeout: time.Second * 3, 27 | } 28 | resp, getErr := netClient.Get("http://api.thingspeak.com/channels/1417/field/2/last.json") 29 | if getErr != nil { 30 | log.Panic(getErr) 31 | } 32 | body, readErr := ioutil.ReadAll(resp.Body) 33 | if readErr != nil { 34 | log.Panic(getErr) 35 | } 36 | 37 | result := cheerlight{} 38 | parseErr := json.Unmarshal(body, &result) 39 | if parseErr != nil { 40 | log.Panic("Can't parse response") 41 | return 0, 0, 0 42 | } 43 | 44 | return getRGBFromColour(result.Colour) 45 | 46 | } 47 | -------------------------------------------------------------------------------- /sysfs/progress/.gitignore: -------------------------------------------------------------------------------- 1 | progress 2 | -------------------------------------------------------------------------------- /sysfs/progress/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | COPY progress / 3 | 4 | CMD ["/progress"] 5 | -------------------------------------------------------------------------------- /sysfs/progress/Dockerfile.build: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian 2 | 3 | # Install Go 1.7.5 and enough of a build-chain to build wiringpi (in C) 4 | RUN apt-get update && \ 5 | apt-get install -qy build-essential wiringpi git curl ca-certificates && \ 6 | curl -sSLO https://storage.googleapis.com/golang/go1.7.5.linux-armv6l.tar.gz && \ 7 | mkdir -p /usr/local/go && \ 8 | tar -xvf go1.7.5.linux-armv6l.tar.gz -C /usr/local/go/ --strip-components=1 9 | 10 | ENV PATH=$PATH:/usr/local/go/bin/ 11 | ENV GOPATH=/go/ 12 | 13 | RUN mkdir -p /go/src/github.com/alexellis/blinkt_go_examples/sysfs/progress 14 | WORKDIR /go/src/github.com/alexellis/blinkt_go_examples/sysfs/progress 15 | 16 | COPY app.go . 17 | RUN go get -d -v 18 | 19 | # RUN go build 20 | RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o progress . 21 | 22 | ENTRYPOINT [] 23 | 24 | CMD ["./progress"] 25 | -------------------------------------------------------------------------------- /sysfs/progress/README.md: -------------------------------------------------------------------------------- 1 | This version of `progress` example uses sysfs so it will work with Docker Swarm. 2 | -------------------------------------------------------------------------------- /sysfs/progress/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import . "github.com/alexellis/blinkt_go/sysfs" 4 | 5 | func main() { 6 | brightness := 0.5 7 | blinkt := NewBlinkt(brightness) 8 | 9 | blinkt.SetClearOnExit(true) 10 | 11 | blinkt.Setup() 12 | 13 | Delay(100) 14 | 15 | r := 0 16 | g := 0 17 | b := 255 18 | 19 | for { 20 | for pixel := 0; pixel < 8; pixel++ { 21 | blinkt.Clear() 22 | blinkt.SetPixel(pixel, r, g, b) 23 | blinkt.Show() 24 | Delay(100) 25 | } 26 | for pixel := 7; pixel > 0; pixel-- { 27 | blinkt.Clear() 28 | blinkt.SetPixel(pixel, r, g, b) 29 | blinkt.Show() 30 | Delay(100) 31 | } 32 | } 33 | blinkt.Clear() 34 | blinkt.Show() 35 | } 36 | -------------------------------------------------------------------------------- /sysfs/progress/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | docker build -t alexellis2/progress-blinkt:sysfs-builder . -f Dockerfile.build && \ 4 | docker create --name sysfs-builder alexellis2/progress-blinkt:sysfs-builder && \ 5 | docker cp sysfs-builder:/go/src/github.com/alexellis/blinkt_go_examples/sysfs/progress/progress . 6 | 7 | docker rm -f sysfs-builder && \ 8 | docker build -t alexellis2/progress-blinkt:blue . -f Dockerfile 9 | 10 | -------------------------------------------------------------------------------- /sysfs/redis_sender/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | COPY app / 3 | 4 | CMD ["/app"] 5 | -------------------------------------------------------------------------------- /sysfs/redis_sender/Dockerfile.build: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian 2 | 3 | # Install Go 1.7.5 and enough of a build-chain to build wiringpi (in C) 4 | RUN apt-get update && \ 5 | apt-get install -qy build-essential wiringpi git curl ca-certificates && \ 6 | curl -sSLO https://storage.googleapis.com/golang/go1.7.5.linux-armv6l.tar.gz && \ 7 | mkdir -p /usr/local/go && \ 8 | tar -xvf go1.7.5.linux-armv6l.tar.gz -C /usr/local/go/ --strip-components=1 9 | 10 | ENV PATH=$PATH:/usr/local/go/bin/ 11 | ENV GOPATH=/go/ 12 | 13 | RUN mkdir -p /go/src/github.com/alexellis/blinkt_go_examples/sysfs/progress 14 | WORKDIR /go/src/github.com/alexellis/blinkt_go_examples/sysfs/progress 15 | 16 | COPY app.go . 17 | RUN go get -d -v 18 | 19 | RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . 20 | 21 | ENTRYPOINT [] 22 | 23 | CMD ["./progress"] 24 | -------------------------------------------------------------------------------- /sysfs/redis_sender/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "gopkg.in/redis.v5" 7 | "os" 8 | "time" 9 | ) 10 | 11 | type LedColor struct { 12 | Red int `json:"r"` 13 | Green int `json:"g"` 14 | Blue int `json:"b"` 15 | } 16 | 17 | type LedMsg struct { 18 | Leds []LedColor `json:"leds"` 19 | } 20 | 21 | func newClient() *redis.Client { 22 | addr := os.Getenv("ADDR") 23 | client := redis.NewClient(&redis.Options{ 24 | Addr: addr + ":6379", 25 | Password: "", // no password set 26 | DB: 0, // use default DB 27 | }) 28 | 29 | // Output: PONG 30 | return client 31 | } 32 | 33 | func main() { 34 | client := newClient() 35 | pong, err := client.Ping().Result() 36 | fmt.Println(pong, err) 37 | 38 | i := 0 39 | dir := 0 40 | for { 41 | ledMsg := LedMsg{} 42 | ledMsg.Leds = make([]LedColor,8) 43 | // fmt.Printf("Dir=%d,i=%d\n",dir,i) 44 | ledMsg.Leds[i].Red = 255 45 | if(dir == 0) { 46 | i++ 47 | if(i == 7) { 48 | dir = 1 49 | } 50 | } else if (dir == 1) { 51 | i-- 52 | if i == 0 { 53 | dir = 0 54 | } 55 | } 56 | 57 | jsonValue, _:= json.Marshal(&ledMsg) 58 | 59 | pubErr := client.Publish("lights", string(jsonValue)).Err() 60 | if pubErr != nil { 61 | panic(pubErr) 62 | } 63 | time.Sleep(150 * time.Millisecond) 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /sysfs/redis_sender/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy -t alexellis2/redis-sender:builder . -f Dockerfile.build && \ 4 | docker create --name sysfs-builder alexellis2/redis-sender:builder && \ 5 | docker cp sysfs-builder:/go/src/github.com/alexellis/blinkt_go_examples/sysfs/progress/app . && \ 6 | docker rm -f sysfs-builder && \ 7 | docker build -t alexellis2/redis-sender:latest . 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /sysfs/redis_view/.gitignore: -------------------------------------------------------------------------------- 1 | redis_view 2 | 3 | -------------------------------------------------------------------------------- /sysfs/redis_view/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | COPY app / 3 | 4 | CMD ["/app"] 5 | -------------------------------------------------------------------------------- /sysfs/redis_view/Dockerfile.build: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian 2 | 3 | # Install Go 1.7.5 and enough of a build-chain to build wiringpi (in C) 4 | RUN apt-get update && \ 5 | apt-get install -qy build-essential wiringpi git curl ca-certificates && \ 6 | curl -sSLO https://storage.googleapis.com/golang/go1.7.5.linux-armv6l.tar.gz && \ 7 | mkdir -p /usr/local/go && \ 8 | tar -xvf go1.7.5.linux-armv6l.tar.gz -C /usr/local/go/ --strip-components=1 9 | 10 | ENV PATH=$PATH:/usr/local/go/bin/ 11 | ENV GOPATH=/go/ 12 | 13 | RUN mkdir -p /go/src/github.com/alexellis/blinkt_go_examples/sysfs/progress 14 | WORKDIR /go/src/github.com/alexellis/blinkt_go_examples/sysfs/progress 15 | 16 | COPY app.go . 17 | RUN go get -d -v 18 | 19 | RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . 20 | 21 | ENTRYPOINT [] 22 | 23 | CMD ["./progress"] 24 | -------------------------------------------------------------------------------- /sysfs/redis_view/README.md: -------------------------------------------------------------------------------- 1 | ### Synchronised Blinkt via Redis 2 | 3 | We have sender code, receiver code and then Redis as the connective tissue using a channel to exchange information. 4 | 5 | 6 | * Run this on your RPis that have a Blinkt attached: 7 | 8 | ``` 9 | $ docker run -v /sys:/sys -e ADDR=192.168.2.21 -d alexellis2/redis-view 10 | ``` 11 | 12 | *Alter the ADDR to match the IP of the machine with Redis* 13 | 14 | * To run Redis on an RPi: 15 | 16 | ``` 17 | $ docker run --name redis -d -p 6379:6379 alexellis2/redis-armhf 18 | ``` 19 | 20 | If you want to debug messages on Redis: 21 | 22 | ``` 23 | $ docker run -ti redis-armhf redis-cli -h 192.168.2.21 24 | ``` 25 | 26 | * Run this on your "sender" 27 | 28 | ``` 29 | $ cd redis_view 30 | $ go run app.go 31 | ``` 32 | 33 | #### Docker Swarm 34 | 35 | For Swarm do the following: 36 | 37 | ``` 38 | $ docker network create --driver overlay --attachable=true blinkt 39 | 40 | $ docker service create --name redis --replicas=1 --network=blinkt --publish 6379:6379 \ 41 | alexellis2/redis-armhf:latest 42 | 43 | $ docker service create --name redis_view --mount type=bind,source=/sys,destination=/sys \ 44 | -e ADDR=redis --network=blinkt \ 45 | --mode=global alexellis2/redis-view:latest 46 | 47 | # optionally: --constraint='node.role != manager' 48 | ``` 49 | 50 | You can invoke the sender as a service like this: 51 | 52 | ``` 53 | $ docker service rm redis_sender; docker service create --name redis_sender --replicas=1 --network=blinkt -e ADDR=redis alexellis2/redis-view:latest 54 | ``` 55 | 56 | -------------------------------------------------------------------------------- /sysfs/redis_view/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "os" 7 | ) 8 | 9 | import . "github.com/alexellis/blinkt_go/sysfs" 10 | 11 | type LedColor struct { 12 | Red int `json:"r"` 13 | Green int `json:"g"` 14 | Blue int `json:"b"` 15 | } 16 | 17 | type LedMsg struct { 18 | Leds []LedColor `json:"leds"` 19 | } 20 | 21 | func newClient() *redis.Client { 22 | addr := os.Getenv("ADDR") 23 | client := redis.NewClient(&redis.Options{ 24 | Addr: addr + ":6379", 25 | Password: "", // no password set 26 | DB: 0, // use default DB 27 | }) 28 | 29 | // Output: PONG 30 | return client 31 | } 32 | 33 | func main() { 34 | brightness := 0.5 35 | blinkt := NewBlinkt(brightness) 36 | blinkt.SetClearOnExit(true) 37 | 38 | blinkt.Setup() 39 | 40 | client := newClient() 41 | pong, err := client.Ping().Result() 42 | fmt.Println(pong, err) 43 | 44 | pubsub, err := client.Subscribe("lights") 45 | if err != nil { 46 | panic(err) 47 | } 48 | defer pubsub.Close() 49 | for { 50 | msg, err := pubsub.ReceiveMessage() 51 | if err != nil { 52 | panic(err) 53 | } 54 | if msg.Channel == "lights" { 55 | ledMsg := LedMsg{} 56 | jsonErr := json.Unmarshal([]byte(msg.Payload), &ledMsg) 57 | if jsonErr != nil { 58 | fmt.Println(jsonErr) 59 | } 60 | 61 | blinkt.Clear() 62 | 63 | var r, g, b int 64 | fmt.Println("Setting LEDs") 65 | 66 | for pixel := 0; pixel < 8; pixel++ { 67 | if pixel > len(ledMsg.Leds) { 68 | r = 0 69 | g = 0 70 | b = 0 71 | } else { 72 | r = ledMsg.Leds[pixel].Red 73 | g = ledMsg.Leds[pixel].Green 74 | b = ledMsg.Leds[pixel].Blue 75 | } 76 | blinkt.SetPixel(pixel, r, g, b) 77 | } 78 | blinkt.Show() 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /sysfs/redis_view/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy -t alexellis2/redis-view:builder . -f Dockerfile.build && \ 4 | docker create --name sysfs-builder alexellis2/redis-view:builder && \ 5 | docker cp sysfs-builder:/go/src/github.com/alexellis/blinkt_go_examples/sysfs/progress/progress . && \ 6 | docker rm -f sysfs-builder && \ 7 | docker build -t alexellis2/redis-view:latest . 8 | 9 | 10 | --------------------------------------------------------------------------------