add ws2812 functionality
confusedbread confuseddbread@gmail.com
Mon, 09 Mar 2026 19:23:05 +0100
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) +}