badges/leds.go
Daniel Esteban b5e08452b6 added files
2026-04-14 19:21:59 +02:00

35 lines
589 B
Go

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)
}
for l := 0; l < numLEDs; l++ {
ledColors[l] = colorBlack
}
leds.WriteColors(ledColors)
time.Sleep(50 * time.Millisecond)
display.EnableBacklight(true)
}