Skip to content

Instantly share code, notes, and snippets.

@actuino
Created March 20, 2017 08:38
Show Gist options
  • Save actuino/3f1c5c5746a9f41ffa124c5eee90070c to your computer and use it in GitHub Desktop.
Save actuino/3f1c5c5746a9f41ffa124c5eee90070c to your computer and use it in GitHub Desktop.
A basic Go demo app for the Blinkt! - See http://www.actuino.fr/raspi/learn-go-pi.html
package main
import . "github.com/alexellis/blinkt_go"
func main() {
brightness := 0.5
blinkt := NewBlinkt(brightness)
blinkt.SetClearOnExit(true)
blinkt.Setup()
Delay(100)
r := 0
g := 150
b := 0
for {
for pixel := 0; pixel < 8; pixel++ {
blinkt.Clear()
blinkt.SetPixel(pixel, r, g, b)
if pixel > 0 {
blinkt.SetPixel(pixel-1, 0,25,0)
}
if pixel > 1 {
blinkt.SetPixel(pixel-2, 0,10,0)
}
if pixel == 0 || pixel == 7 { blinkt.SetPixel(pixel, 100,50,0) }
blinkt.Show()
Delay(100)
}
for pixel := 6; pixel > 0; pixel-- {
blinkt.Clear()
blinkt.SetPixel(pixel, r, g, b)
if pixel < 7 {
blinkt.SetPixel(pixel+1, 0,25,0)
}
if pixel < 6 {
blinkt.SetPixel(pixel+2,0,25,0)
}
if pixel == 0 || pixel == 7 { blinkt.SetPixel(pixel, 100,50,0) }
blinkt.Show()
Delay(100)
}
}
blinkt.Clear()
blinkt.Show()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment