Created
June 8, 2017 21:23
-
-
Save ThePendulum/052a41e988a6c82bfebcb59f2ac4fa15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log/syslog" | |
"rpi_ws281x/golang/ws2811" | |
"time" | |
"ara/color" | |
"os" | |
"fmt" | |
) | |
func driver(logger *syslog.Writer, hsv *color.Hsv) { | |
context := map[string]int{ | |
"length": config.Length, | |
} | |
if err := ws2811.Init(18, 300, 255); err != nil { | |
fmt.Println(err) | |
os.Exit(1) | |
} | |
for b := 0; b >= 0; b++ { | |
context["beat"] = b | |
for i := 0; i < config.Length; i++ { | |
context["index"] = i | |
result := color.HsvToColor(call(hsv.Hue, context), call(hsv.Saturation, context), call(hsv.Value, context)) | |
ws2811.SetLed(i, result) | |
} | |
ws2811.Render() | |
time.Sleep(time.Second / time.Duration(config.Fps)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment