all repos — visor @ b5930655b1a93d4662246e8087198f0ce0330e9a

Unnamed repository; edit this file 'description' to name the repository.

add ws2812 functionality
confusedbread confuseddbread@gmail.com
Mon, 09 Mar 2026 19:23:05 +0100
commit

b5930655b1a93d4662246e8087198f0ce0330e9a

parent

4c8be238d3a2ef149ff7b438a86f73bbd392f859

3 files changed, 39 insertions(+), 1 deletions(-)

jump to
M go.modgo.mod

@@ -1,3 +1,8 @@

module codeberg.org/confusedbread/visor.git -go 1.25.0 +go 1.24.0 + +require ( + github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect + tinygo.org/x/drivers v0.34.0 // indirect +)
A go.sum

@@ -0,0 +1,4 @@

+github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= +github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= +tinygo.org/x/drivers v0.34.0 h1:lw8ePJeUSn9oICKBvQXHC9TIE+J00OfXfkGTrpXM9Iw= +tinygo.org/x/drivers v0.34.0/go.mod h1:ZdErNrApSABdVXjA1RejD67R8SNRI6RKVfYgQDZtKtk=
A main.go

@@ -0,0 +1,29 @@

+package main + +import ( + "image/color" + "machine" + + "tinygo.org/x/drivers/ws2812" +) + +const ledCount = 512 + +func main() { + var pin machine.Pin + pin = 13 + pin.Configure(machine.PinConfig{Mode: machine.PinOutput}) + + device := ws2812.NewWS2812(pin) + + leds := make([]color.RGBA, ledCount) + for i := range leds { + leds[i] = color.RGBA{ + R: 0, + G: 10, + B: 0, + } + } + + device.WriteColors(leds) +}