36 lines
589 B
Go
36 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)
|
||
|
|
}
|