Closed diamondburned closed 11 months ago
Hmm, it's really hard to say what exactly goes wrong here. This could be so many issues.
As a first step, can you try disabling interrupts?
import "runtime/interrupt"
...
state := interrupt.Disable()
led.WriteColors(colors[:])
interrupt.Restore(state)
Then, there could be many reasons for this particular issue, like:
(Also thanks for the very detailed issue report!)
Have you connected the ground of the power source and of the ESP32? It's hard to see from the video, but I don't think I see a ground wire.
This ended up being the problem... Sorry for wasting your time...
Good to hear, happy to help :)
PR https://github.com/tinygo-org/drivers/pull/313 apparently adds support for WS2811 driven at 5V, but does 12V change this?
I'm currently writing a test program similar to the one in the example and flashing it onto an ESP32, but the LEDs just flicker:
https://github.com/tinygo-org/drivers/assets/8463786/4d8562e8-f1d1-473f-8bf5-cd2431175cae
Reproducing code
```go package main import ( "image/color" "machine" "time" "tinygo.org/x/drivers/ws2812" ) const numLEDs = 50 var colors [numLEDs]color.RGBA func main() { machine.GPIO1.Configure(machine.PinConfig{Mode: machine.PinOutput}) led := ws2812.New(machine.GPIO1) var state bool for { for i := range colors { if state { colors[i] = color.RGBA{255, 0, 0, 255} } else { colors[i] = color.RGBA{0, 0, 0, 255} } } led.WriteColors(colors[:]) state = !state time.Sleep(time.Second) } } ```Build command
``` sudo tinygo flash -target=esp32-coreboard-v2 -port=/dev/ttyUSB0 ```Product information
- ESP32: https://www.amazon.com/gp/product/B0B9G74NNM - WS2811 LEDs: https://www.amazon.com/gp/product/B01AG923EU