badges/leds.go

36 lines
626 B
Go
Raw Normal View History

2026-04-14 17:21:59 +00:00
package main
import (
"image/color"
"time"
)
func Leds() {
display.EnableBacklight(false)
display.FillScreen(color.RGBA{0, 0, 0, 255})
ledColors := make([]color.RGBA, numLEDs)
var i uint8
for {
getInput()
for l := uint8(0); l < numLEDs; l++ {
ledColors[l] = getRainbowRGB(i + ((50 * l) / numLEDs))
}
leds.WriteColors(ledColors)
if goBack() {
break
}
i += 2
time.Sleep(50 * time.Millisecond)
}
time.Sleep(50 * time.Millisecond)
2026-04-14 17:21:59 +00:00
for l := 0; l < numLEDs; l++ {
ledColors[l] = colorBlackLED
2026-04-14 17:21:59 +00:00
}
leds.WriteColors(ledColors)
time.Sleep(50 * time.Millisecond)
display.EnableBacklight(true)
}