DeqingSun / ch55xduino

An Arduino-like programming API for the CH55X
GNU Lesser General Public License v2.1
449 stars 87 forks source link

WS2812 without delay #90

Closed kbln closed 1 year ago

kbln commented 2 years ago

Hi all!

neopixel_show_ P1_5(ledData, NUM_BYTES); // does not work without delay(1)
delay(1);

How can i make it work without delay?

DeqingSun commented 2 years ago

The delay has to be there. But you may change it to delayMicroseconds(50). Because you need to give the WS2812 at least 50 us to reset its data. If you don't have other code takes longer than 50us, use a delay or delayMicroseconds.

kbln commented 2 years ago

The delay has to be there. But you may change it to delayMicroseconds(50). Because you need to give the WS2812 at least 50 us to reset its data. If you don't have other code takes longer than 50us, use a delay or delayMicroseconds.

Thanks for the answer! I will try delayMicroseconds(50)

I am trying to run Adalight on ch552G, but Serial is very slow. I think the delay is the problem.