Arduino Tlc5940 Library Documentation

r8 - 2009-02-16

The Texas Instruments TLC5940 is a 16-channel, constant-current sink LED driver. Each channel has an individually adjustable 4096-step grayscale PWM brightness control and a 64-step, constant-current sink (no LED resistors needed!). This chip is a current sink, so be sure to use common anode RGB LEDs.

Check the tlc5940arduino project on Google Code for updates. To install, unzip the "Tlc5940" folder to <Arduino Folder>/hardware/libraries/


Hardware Setup

The basic hardware setup is explained at the top of the Examples. A good place to start would be the BasicUse Example. (The examples are in File->Sketchbook->Examples->Library-Tlc5940).

All the options for the library are located in tlc_config.h, including NUM_TLCS, what pins to use, and the PWM period. After changing tlc_config.h, be sure to delete the Tlc5940.o file in the library folder to save the changes.


Library Reference

Core Functions (see the BasicUse Example and Tlc5940):

Extended Functions. These require an include statement at the top of the sketch to use.

Functions that require VPRG_ENABLED. These require VPRG_ENABLED == 1 in tlc_config.h


Expanding the Library

Lets say we wanted to add a function like "tlc_goCrazy(...)". The first thing to do is to create a source file in the library folder, "tlc_my_crazy_functions.h". A template for this .h file is
// Explination for my crazy function extension


#include "tlc_config.h"
#include "Tlc5940.h"

void tlc_goCrazy(void);

void tlc_goCrazy(void)
    uint16_t crazyFactor = 4000;
    for (uint8_t channel = 4; channel < 9; channel++) {
        Tlc.set(channel, crazyFactor);

Now to use your library in a sketch, just add
#include "tlc_my_crazy_functions.h"

// ...

If you would like to share your extended functions for others to use, email me (acleone ~AT~ with the file and an example and I'll include them in the library.



If you found a bug in the library, email me so I can fix it! My email is acleone ~AT~


License - GPLv3

Copyright (c) 2009 by Alex Leone <acleone ~AT~>

This file is part of the Arduino TLC5940 Library.

The Arduino TLC5940 Library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Arduino TLC5940 Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with The Arduino TLC5940 Library. If not, see <>.

Generated on Mon Feb 16 13:52:57 2009 for Arduino Tlc5940 Library by  doxygen 1.5.6