Dependencies¶
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.
Installing from PyPI¶
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:
pip3 install adafruit-circuitpython-tlc59711
To install system-wide (this may be required in some cases):
sudo pip3 install adafruit-circuitpython-tlc59711
To install in a virtual environment in your current project:
mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install adafruit-circuitpython-tlc59711
Usage Example¶
See examples/tlc59711_simpletest.py for a demo of the usage.
Contributing¶
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Documentation¶
For information on building library documentation, please check out this guide.
Table of Contents¶
Simple test¶
Ensure your device works with this simple test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
# Simple demo of the TLC59711 16-bit 12 channel LED PWM driver.
# Shows setting channel values in a few ways.
# Author: Tony DiCola
import board
import busio
import adafruit_tlc59711
# Define SPI bus connected to chip. You only need the clock and MOSI (output)
# line to use this chip.
spi = busio.SPI(board.SCK, MOSI=board.MOSI)
# Define the TLC59711 instance.
leds = adafruit_tlc59711.TLC59711(spi)
# Optionally you can disable the auto_show behavior that updates the chip
# as soon as any channel value is written. The default is True/on but you can
# disable and explicitly call show to control when updates happen for better
# animation or atomic RGB LED updates.
# leds = adafruit_tlc59711.TLC59711(spi, auto_show=False)
# There are a couple ways to control the channels of the chip.
# The first is using an interface like a strip of NeoPixels. Index into the
# class for the channel and set or get its R, G, B tuple value. Note the
# component values are 16-bit numbers that range from 0-65535 (off to full
# brightness). Remember there are only 4 channels available too (0 to 3).
# For example set channel 0 (R0, G0, B0) to half brightness:
leds[0] = (32767, 32767, 32767)
# Dont forget to call show if you disabled auto_show above.
# leds.show()
# Or to set channel 1 to full red only (green and blue off).
leds[1] = (65535, 0, 0)
# You can also explicitly control each R0, G0, B0, R1, B1, etc. channel
# by getting and setting its 16-bit value directly with properties.
# For example set channel 2 to full green (i.e. G2 to maximum):
leds.g2 = 65535
# Again don't forget to call show if you disabled auto_show above.
# leds.show()
# The chip also supports global brightness channels to change the red, green,
# blue colors of all 4 channels at once. These are 7-bit values that range
# from 0-127. Get and set them with the red_brightness, green_brightness,
# and blue_brightness properties and again be sure to call show if you
# disabled auto_show.
# For example set the red channel to half brightness globally.
leds.red_brightness = 63
# Don't forget to call show if you disabled auto_show above.
# leds.show()
|
adafruit_tlc59711
¶
CircuitPython module for the TLC59711 16-bit 12 channel LED PWM driver. See examples/simpletest.py for a demo of the usage.
- Author(s): Tony DiCola
Implementation Notes¶
Hardware:
- Adafruit 12-Channel 16-bit PWM LED Driver - SPI Interface - TLC59711 (Product ID: 1455)
Software and Dependencies:
- Adafruit CircuitPython firmware for the ESP8622 and M0-based boards: https://github.com/adafruit/circuitpython/releases
-
class
adafruit_tlc59711.
TLC59711
(spi, *, auto_show=True)[source]¶ TLC59711 16-bit 12 channel LED PWM driver. This chip is designed to drive 4 RGB LEDs with 16-bit PWM control of each LED. The class has an interface much like that of NeoPixels with attribute access to the 4 RGB channels (note they are 16-bit values). Or you can access each independent channel by name (r0, g0, b0, r1, b1, etc.) as properties for fine-grained control.
Parameters: - spi (SPI) – An instance of the SPI bus connected to the chip. The clock and MOSI/outout must be set, the MISO/input is unused.
- auto_show (bool) – This is a boolean that defaults to True and indicates any change to a channel value will instantly be written to the chip. You might wish to set this to false if you desire to perform your own atomic operations of channel values. In that case call the show function after making updates to channel state.
-
blue_brightness
¶ The blue brightness for all channels (i.e. B0, B1, B2, and B3). This is a 7-bit value from 0-127.
-
green_brightness
¶ The green brightness for all channels (i.e. G0, G1, G2, and G3). This is a 7-bit value from 0-127.
-
red_brightness
¶ The red brightness for all channels (i.e. R0, R1, R2, and R3). This is a 7-bit value from 0-127.