Working with the TLC5940

08 Mar 2011

Hey guys!!

Iam working on a RGB Led Project using the TLC5940s.

So I've got my first TLC up an runing put I'am quite confused with it. I use the library from the Cookbook.

My question:

Is it possible to get the send routine out of the main loop? (Something like a timer that automatically sends the data so the main loop stays free)

PS: Sry for my bad english but i usually speak german. Iam from Austria.

08 Mar 2011

There's a good reason for putting as much as possible into the main loop (or function ultimately called from the main loop). Please have a read of this to understand why.

It is possible to just create a timer and in it's callback function and place the send routine in there. But read the above article first before starting to plonk lots of code in callbacks just to "keep the main loop clean". The main loop is your workhorse. Keep it clean by only calling out to other functions rather than leave it empty.

08 Mar 2011

Oh, and I should have said, if you want a "nice tidy" main loop, don't need any advanced RTOS you could always look at SimpleScheduler which I like to use as a simple "cable tidy" for functions :)

Import librarySimpleScheduler

Very simple cooperative round-robin task scheduler. See examples.

09 Mar 2011

Thank you Andy :D

The Scheduler helped me alot!