Programming - Library Reference

Install The Library

To use these boards, first download and install the library using one of the buttons below. If you are new to Arduino Libraries, check this guide for instructions on how to install them:

http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use

Run the Example Code


Wire your breakout and connect some LEDs as shown on the previous pages. Load the example code for your breakout board:

File->Examples->Adafruit_59711->tlc59711test
or:
File->Examples->Adafruit_5947->tlc5947test

And run. If you are using RGB LEDs, the code will cycle through some colors to demonstrate the capabilities of the board.

TLC5947 Library Reference:

Adafruit_TLC5947(uint8_t n, uint8_t c, uint8_t d, uint8_t l)
Call the constructor to create an instance of the TLC5947 PWM breakout driver.
  • n = Number of Drivers (>1 if the drivers are chained)
  • c = Clock pin
  • d = Data pin
  • l = Latch pin

boolean begin(void);
Call begin just once in your setup() function to initialize the devices.

void setPWM(uint8_t chan, uint16_t pwm);
Call this to set the PWM level for a channel.
  • chan = Channel
  • pwm = PWM level (0 = minimum, 4095 = maximum)

void setLED(uint8_t lednum, uint16_t r, uint16_t g, uint16_t b);
Call this to set the RGB value for a group of 3 channels
  • lednum = LED number (channel number of the "red" pin divided by 3)
  • r = red level
  • g = green level
  • b = blue level

void write(void);
Call this after every change to write the new PWM levels to the device.

TLC59711 Library Reference:

Adafruit_TLC59711(uint8_t n, uint8_t c, uint8_t d);
Call the constructor to create an instance of the TLC59711 PWM breakout driver.

  • n = Number of Drivers (>1 if the drivers are chained)
  • c = Clock Pin
  • D = Data Pin


Adafruit_TLC59711(uint8_t n);
Alternate consturctor for hardware SPI. Assumes hardware SPI pins for MOSI and SCK.

boolean begin(void);
Call begin just once in your setup() function to initialize the devices.

void setPWM(uint8_t chan, uint16_t pwm);
Call this to set the PWM level for a channel.

  • chan = Channel
  • pwm = PWM level (0 = minimum, 65535= maximum)


void setLED(uint8_t lednum, uint16_t r, uint16_t g, uint16_t b);
Call this to set the RGB value for a group of 3 channels

  • lednum = LED number (channel number of the "red" pin divided by 3)
  • r = red level
  • g = green level
  • b = blue level

void write(void);
Call this after every change to write the new PWM levels to the device.

This guide was first published on Dec 06, 2013. It was last updated on Dec 06, 2013. This page (Programming - Library Reference) was last updated on Sep 15, 2019.