Teensy 3.2 - How to use timer with OctoWS2811 lib

Status
Not open for further replies.
Hi all,

I need to execute my program with a precis timing, and for that I used to use "IntervalTimer" functionality and librarie.
But it doesn't work if I use OctoWS2811 to drive RGB leds. This is the same issue with TimerOne and TimerThree.

Is it normal? Is there another way to execute precis timing?
I mean set a flag in interrupt timer function, and execut program in the main function only when this flag is set and clear it inside.

Thank a lot
 
How precise? 1 ms - 10 us? Is the loop() doing anything much?

How many times/sec is loop() being called?
 
I need a loop executed between 10 and 100 times/sec (I need make tests).

The main loop manage the LEDs animations and take into account informations received by I2C to change strip's colors.
How precise? 1ms is a maximum, 0.1ms is ideal
 
Should be easy to just watch a changing timer value. If T_3.2 is not burdened will easily pass 1K or 10K or more loops /second.

This example could easily count and display the counts per second of loop entry: ...\examples\02.Digital\BlinkWithoutDelay\BlinkWithoutDelay.ino

Better tools may be elapsedMillis or elapsedMicros - examples on PJRC.com.

Give it a try and maybe measure the longest time between loops calls - to be sure when needed it won't be a late arrival.
 
Thank a lot for your replies and your help.
It seems that many of my issues was due to the fact I forgot that OctoWs8211 is an blocking library...

Also did you know there is a way to use I2C in slave mode with OctoWS8211?
 
OctoWS8211 is non-blocking. It returns quickly to your program and the LEDs are updated by DMA while your code continues to run. That is what non-blocking means.

Also did you know there is a way to use I2C in slave mode with OctoWS8211?

I2C slave mode and OctoWS8211 should work together. If they are not working, maybe you should share a (simple, small code) test case that shows us how to reproduce the problem you're seeing?

On the timing, consider WS2812B LEDs use ~425 Hz PWM internally. Expecting 0.1 ms sync to LEDs is meaningless when their own internal PWM is much slower.
 
Status
Not open for further replies.
Back
Top