Arduino & TLC5940, Code Suggestions

Hi all,

I've been an electronics hobbyist for several decades. I'm struggling with coding in regards to the Arduino. I took turbo & pascal programming in the late 80s. I do understand syntax and variable use with coding, but with my current project, I'm at a loss with how to structure everything. I have studied the TLC5940 datasheet, libraries and examples including spark funs version for the TLC5094.

I am using IDE 1.8.10, using a nano 328 (old bootloader) and daisy-chaining 2 TLC5940s. I do have the required TLC libraries installed. I will be using attachment #1 for the wiring diagram and attachment #2 the TLC5940 datasheet.

I'm looking to build a backlit display panel with 28 10mm LEDs along with the circuit in attachment #1. Basically I need a number of the 28 LEDs to light up until their delay time, then start the next number of lit LEDs/delay. In attachment #3, I broke down my animation to 20 frames for the sequence. I numbered each LED in the lightbox and broke down the number of LEDs lit and delay for each of the frames. Finally, loop the entire sequence.

I have looked over as many examples as I could find using the TLC5940 configuration. I may be in over my head on this project. I haven't found a project that was quite like what I needed and have been trying to bodge together bits and pieces of various code with no success. I have modified the h file to reflect the number of TLCs and the wiring on my breadboard is solid and accurate. What I liked about the TLC option was that it eliminates the need for current limiting resistors for the LEDs and you can control the LED brightness with code. I know I am missing some key elements. I didn't think to save any of my attempts at trying bodged code as nothing was working. Any help or a point in the right direction would be greatly appreciated.

TLC5940-PWM-driver-datasheet.pdf (1.3 MB)

Add a 0.1uF ceramic capacitor between power and ground of both chips.

Now you are trying to do too much at once. The secret of writing code, is to write a little and then test. Start off with one of the examples that come with the library and make sure it works. If not then you have a hardware problem with your wiring, no matter how immaculate you think it might be.

Then make changes to that example and see if it does what you expect. That time to get a feel for the language and the hardware. Gradually change the example one small step at a time until it does what you want it to do.

When you get stuck, post your latest code and say what it does and what you want it to do.

Thanks Mike, I have tried sample code and am getting the expected results as it stands, so I know my wiring is good to go, I'm just not able to get the desired result according to my OP.

I'm just not able to get the desired result according to my OP

So post your code and say what it does and what you would like it to do.

Again thanks for your reply. I will post the code I was using this evening after work. I was working off a tutorial, "How To Extend Arduino PWM Outputs – TLC5940 Tutorial" by Mechatronics.

The tutorial was for a single TLC5940, he did another tutorial using 2 TLC5940s at the end of the single-chip tutorial in which I tried some of that code as well.

as I said, I'm building a backlit lightbox panel with 28 10mm LEDs. Attachment #3 breaks down specifically what I'm after. I'm looking to light up a specific number of the 28 LEDs for a specific time period, then light the next frame and time delay continuing through the 20 frames and then loop the sequence. In reference to attachment #3, #1, I want all of the LEDs listed on that line to be on for the specified time and then go to line #2 and light the specified LEDs and so forth through line 20 and repeat the sequence after the 20th.