Simple test

Ensure your device works with this simple test.

examples/tlc59711_simpletest.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4# simple demo of the TLC59711 16-bit 12 channel LED PWM driver.
 5# Shows the minimal usage - how to set pixel values in a few ways.
 6# Author: Tony DiCola
 7
 8import board
 9import busio
10
11import adafruit_tlc59711
12
13print("tlc59711_simpletest.py")
14
15# Define SPI bus connected to chip.
16# You only need the clock and MOSI (output) line to use this chip.
17spi = busio.SPI(board.SCK, MOSI=board.MOSI)
18pixels = adafruit_tlc59711.TLC59711(spi, pixel_count=16)
19
20# examples how to set the pixels:
21# range:
22# 0 - 65535
23# or
24# 0.0 - 1.0
25# every pixel needs a color -
26# give it just a list or tuple with 3 integer values: R G B
27
28# set all pixels to a very low level
29pixels.set_pixel_all((10, 10, 10))
30
31# every chip has 4 Pixels (=RGB-LEDs = 12 Channel)
32pixels[0] = (100, 100, 100)
33pixels[1] = (0, 0, 100)
34pixels[2] = (0.01, 0.0, 0.01)
35pixels[3] = (0.1, 0.01, 0.0)
36# if you are ready to show your values you have to call
37pixels.show()
38
39# there are a bunch of other ways to set pixel.
40# have a look at the other examples.

FancyLED

this is an example for combining the TLC5957 library with FancyLED. Enjoy the colors :-)

examples/tlc59711_fancyled.py
 1#!/usr/bin/env python3
 2# -*- coding: utf-8 -*-
 3# CircuitPython
 4
 5# SPDX-FileCopyrightText: 2021 s-light
 6# SPDX-License-Identifier: MIT
 7# Author Stefan Krüger (s-light)
 8
 9"""TLC59711 & FancyLED."""
10
11__doc__ = """
12TLC59711 & FancyLED.
13
14this is an example for combining the TLC5957 library with FancyLED.
15Enjoy the colors :-)
16"""
17
18import board
19
20import busio
21
22import adafruit_fancyled.adafruit_fancyled as fancyled
23import adafruit_tlc59711
24
25##########################################
26print("\n" + (42 * "*") + "\n" + __doc__ + "\n" + (42 * "*") + "\n" + "\n")
27
28##########################################
29# print(42 * "*")
30# print("initialise digitalio pins for SPI")
31# spi_clock = digitalio.DigitalInOut(board.SCK)
32# spi_clock.direction = digitalio.Direction.OUTPUT
33# spi_mosi = digitalio.DigitalInOut(board.MOSI)
34# spi_mosi.direction = digitalio.Direction.OUTPUT
35# spi_miso = digitalio.DigitalInOut(board.MISO)
36# spi_miso.direction = digitalio.Direction.INPUT
37
38# print((42 * '*') + "\n" + "init busio.SPI")
39spi = busio.SPI(board.SCK, MOSI=board.MOSI)
40
41##########################################
42print(42 * "*")
43print("init TLC5957")
44NUM_LEDS = 16
45pixels = adafruit_tlc59711.TLC59711(
46    spi=spi,
47    pixel_count=NUM_LEDS,
48)
49
50print("pixel_count", pixels.pixel_count)
51print("chip_count", pixels.chip_count)
52print("channel_count", pixels.channel_count)
53
54
55##########################################
56# main loop
57print(42 * "*")
58print("rainbow loop")
59hue_offset = 0
60while True:
61    brightness = 0.8
62    color = fancyled.CHSV(hue_offset, 1.0, 1.0)
63    color = fancyled.gamma_adjust(color, brightness=brightness)
64    pixels.set_pixel_all(color)
65    pixels.show()
66
67    # Bigger number = faster spin
68    hue_offset += 0.000005
69    if hue_offset >= 1:
70        hue_offset = 0
71        print("heu_offset reset")

Animations Example

You should have a plethora of functions to animate your lights.

examples/tlc59711_dev.py
  1#!/usr/bin/env python3
  2# -*- coding: utf-8 -*-
  3# CircuitPython
  4
  5# SPDX-FileCopyrightText: 2021 s-light
  6# SPDX-License-Identifier: MIT
  7# Author Stefan Krüger (s-light)
  8
  9"""TLC5971 / TLC59711 Multi Development."""
 10
 11__doc__ = """
 12TLC59711 development helper.
 13
 14this sketch contains a bunch of timing tests and other development things..
 15Enjoy the colors :-)
 16"""
 17
 18import time
 19
 20import board
 21import busio
 22
 23import adafruit_tlc59711
 24
 25
 26##########################################
 27PIXEL_COUNT = 16 * 1
 28
 29spi = busio.SPI(board.SCK, MOSI=board.MOSI)
 30pixels = adafruit_tlc59711.TLC59711(spi, pixel_count=PIXEL_COUNT)
 31
 32
 33##########################################
 34# test function
 35
 36VALUE_HIGH = 1000
 37
 38
 39def channelcheck_update_pixel(offset):
 40    """Channel check pixel."""
 41    # print("offset", offset)
 42
 43    # pixels[offset] = (VALUE_HIGH, 0, 0)
 44    pixels.set_pixel_16bit_value(offset, VALUE_HIGH, 0, 0)
 45    # clear last pixel
 46    last = offset - 1
 47    if last < 0:
 48        last = PIXEL_COUNT - 1
 49    # pixels[last] = (0, 0, 1)
 50    pixels.set_pixel_16bit_value(last, 0, 0, 1)
 51    # pixels[offset] = (0xAAAA, 0xBBBB, 0xCCCC)
 52    pixels.show()
 53
 54    offset += 1
 55    if offset >= PIXEL_COUNT:
 56        time.sleep(0.2)
 57        offset = 0
 58        print("clear")
 59        pixels.set_pixel_all((0, 1, 0))
 60        pixels.show()
 61    return offset
 62
 63
 64def channelcheck_update(offset):
 65    """Channel check."""
 66    # print("offset", offset)
 67
 68    pixels.set_channel(offset, VALUE_HIGH)
 69    # clear last set channel
 70    last = offset - 1
 71    if last < 0:
 72        last = pixels.channel_count - 1
 73    pixels.set_channel(last, 0)
 74    pixels.show()
 75
 76    offset += 1
 77    if offset >= pixels.channel_count:
 78        offset = 0
 79        print("offset overflow. start from 0")
 80    return offset
 81
 82
 83##########################################
 84
 85
 86def timeit_call(message, test_function, loop_count=1000):
 87    """Measure timing."""
 88    duration = 0
 89    start_time = time.monotonic()
 90    for _index in range(loop_count):
 91        start_time = time.monotonic()
 92        test_function()
 93        end_time = time.monotonic()
 94        duration += end_time - start_time
 95    # print(
 96    #     "duration:\n"
 97    #     "\t{}s for {} loops\n"
 98    #     "\t{:.2f}ms per call"
 99    #     "".format(
100    #         duration,
101    #         loop_count,
102    #         (duration/loop_count)*1000
103    #     )
104    # )
105    # print(
106    #     "\t{:.2f}ms per call"
107    #     "".format((duration / loop_count) * 1000)
108    # )
109    # "{:>8.2f}ms".format(3.56)
110    print(
111        "{call_duration:>10.4f}ms\t{message}"
112        "".format(
113            call_duration=(duration / loop_count) * 1000,
114            message=message,
115        )
116    )
117
118
119def timeit_pixels_show():
120    """Measure timing."""
121    print("*** pixels show:")
122    loop_count = 1000
123
124    def _test():
125        pixels.show()
126
127    timeit_call("'pixels.show()'", _test, loop_count)
128
129
130def timeit_pixels_set_single():
131    """Measure timing pixels set."""
132    print("*** pixels set single:")
133    loop_count = 1000
134
135    def _test():
136        pixels[3] = (500, 40500, 1000)
137
138    timeit_call("'pixels[3] = (500, 40500, 1000)'", _test, loop_count)
139
140    def _test():
141        pixels[3] = (0.1, 0.5, 0.9)
142
143    timeit_call("'pixels[3] = (0.1, 0.5, 0.9)'", _test, loop_count)
144
145    def _test():
146        pixels.set_pixel(3, (500, 40500, 1000))
147
148    timeit_call("'pixels.set_pixel(3, (500, 40500, 1000))'", _test, loop_count)
149
150    def _test():
151        pixels.set_pixel(3, (0.1, 0.5, 0.9))
152
153    timeit_call("'pixels.set_pixel(3, (0.1, 0.5, 0.9))'", _test, loop_count)
154
155
156def timeit_pixels_set_loop():
157    """Measure timing pixels set."""
158    print("*** pixels set loop:")
159    loop_count = 10
160
161    def _test():
162        for i in range(PIXEL_COUNT):
163            pixels[i] = (500, 40500, 1000)
164
165    timeit_call(
166        "'pixels[0..{}] = (500, 40500, 1000)'".format(PIXEL_COUNT), _test, loop_count
167    )
168
169    def _test():
170        for i in range(PIXEL_COUNT):
171            pixels[i] = (0.1, 0.5, 0.9)
172
173    timeit_call(
174        "'pixels[0..{}] = (0.1, 0.5, 0.9)'".format(PIXEL_COUNT), _test, loop_count
175    )
176
177    def _test():
178        for i in range(PIXEL_COUNT):
179            pixels.set_pixel(i, (500, 40500, 1000))
180
181    timeit_call(
182        "'pixels.set_pixel(0..{}, (500, 40500, 1000))'".format(PIXEL_COUNT),
183        _test,
184        loop_count,
185    )
186
187    def _test():
188        for i in range(PIXEL_COUNT):
189            pixels.set_pixel(i, (0.1, 0.5, 0.9))
190
191    timeit_call(
192        "'pixels.set_pixel(0..{}, (0.1, 0.5, 0.9))'".format(PIXEL_COUNT),
193        _test,
194        loop_count,
195    )
196
197
198def timeit_pixels_set_all():
199    """Measure timing pixels set."""
200    print("*** pixels set all:")
201    loop_count = 10
202
203    def _test():
204        pixels.set_pixel_all((500, 40500, 1000))
205
206    timeit_call("'pixels.set_pixel_all((500, 40500, 1000))'", _test, loop_count)
207
208    def _test():
209        pixels.set_pixel_all((0.1, 0.5, 0.9))
210
211    timeit_call("'pixels.set_pixel_all((0.1, 0.5, 0.9))'", _test, loop_count)
212
213    def _test():
214        pixels.set_pixel_all_16bit_value(500, 40500, 1000)
215
216    timeit_call(
217        "'pixels.set_pixel_all_16bit_value(500, 40500, 1000)'", _test, loop_count
218    )
219
220    def _test():
221        pixels.set_all_black()
222
223    timeit_call("'pixels.set_all_black()'", _test, loop_count)
224
225
226def timeit_pixels_set_16bit():
227    """Measure timing pixels set."""
228    print("*** pixels set 16bit:")
229    loop_count = 1000
230
231    def _test():
232        pixels.set_pixel_16bit_value(3, 500, 40500, 1000)
233
234    timeit_call(
235        "'pixels.set_pixel_16bit_value(3, 500, 40500, 1000)'", _test, loop_count
236    )
237
238    def _test():
239        pixels.set_pixel_16bit_color(3, (500, 40500, 1000))
240
241    timeit_call(
242        "'pixels.set_pixel_16bit_color(3, (500, 40500, 1000))'", _test, loop_count
243    )
244
245    def _test():
246        for i in range(PIXEL_COUNT):
247            pixels.set_pixel_16bit_value(i, 500, 40500, 1000)
248
249    timeit_call(
250        "'pixels.set_pixel_16bit_value(0..{}, 500, 40500, 1000)'"
251        "".format(PIXEL_COUNT),
252        _test,
253        10,
254    )
255
256    def _test():
257        for i in range(PIXEL_COUNT):
258            pixels.set_pixel_16bit_color(i, (500, 40500, 1000))
259
260    timeit_call(
261        "'pixels.set_pixel_16bit_color(0..{}, (500, 40500, 1000))'"
262        "".format(PIXEL_COUNT),
263        _test,
264        10,
265    )
266
267
268def timeit_pixels_set_float():
269    """Measure timing pixels set."""
270    print("*** pixels set float:")
271    loop_count = 1000
272
273    def _test():
274        pixels.set_pixel_float_value(3, 0.1, 0.5, 0.9)
275
276    timeit_call("'pixels.set_pixel_float_value(3, 0.1, 0.5, 0.9)'", _test, loop_count)
277
278    def _test():
279        pixels.set_pixel_float_color(3, (0.1, 0.5, 0.9))
280
281    timeit_call("'pixels.set_pixel_float_color(3, (0.1, 0.5, 0.9))'", _test, loop_count)
282
283    def _test():
284        for i in range(PIXEL_COUNT):
285            pixels.set_pixel_float_value(i, 0.1, 0.5, 0.9)
286
287    timeit_call(
288        "'pixels.set_pixel_float_value(0..{}, 0.1, 0.5, 0.9)'" "".format(PIXEL_COUNT),
289        _test,
290        10,
291    )
292
293    def _test():
294        for i in range(PIXEL_COUNT):
295            pixels.set_pixel_float_color(i, (0.1, 0.5, 0.9))
296
297    timeit_call(
298        "'pixels.set_pixel_float_color(0..{}, (0.1, 0.5, 0.9))'" "".format(PIXEL_COUNT),
299        _test,
300        10,
301    )
302
303    def _test():
304        for i in range(PIXEL_COUNT):
305            pixels.set_pixel_16bit_value(
306                i, int(0.1 * 65535), int(0.5 * 65535), int(0.9 * 65535)
307            )
308
309    timeit_call(
310        "'pixels.set_pixel_16bit_value(0..{}, f2i 0.1, f2i 0.5, f2i 0.9)'"
311        "".format(PIXEL_COUNT),
312        _test,
313        10,
314    )
315
316
317def timeit_channel_set():
318    """Measure timing channel set."""
319    print("*** channel set:")
320    loop_count = 1000
321
322    def _test():
323        pixels.set_channel(0, 10000)
324
325    timeit_call("'set_channel(0, 10000)'", _test, loop_count)
326
327    def _test():
328        pixels.set_channel(0, 10000)
329        pixels.set_channel(1, 10000)
330        pixels.set_channel(2, 10000)
331
332    timeit_call("'set_channel(0..2, 10000)'", _test, loop_count)
333
334    channel_count = PIXEL_COUNT * 3
335
336    def _test():
337        for i in range(channel_count):
338            pixels.set_channel(i, 500)
339
340    timeit_call("'set_channel(for 0..{}, 10000)'" "".format(channel_count), _test, 10)
341
342
343def timeit_channel_set_internal():
344    """Measure timing channel set internal."""
345    print("*** channel set internal:")
346    # loop_count = 1000
347    #
348    # def _test():
349    #     pixels._set_channel_16bit_value(0, 10000)
350    # timeit_call(
351    #     "'_set_channel_16bit_value(0, 10000)'",
352    #     _test,
353    #     loop_count
354    # )
355    #
356    # def _test():
357    #     pixels._set_channel_16bit_value(0, 10000)
358    #     pixels._set_channel_16bit_value(1, 10000)
359    #     pixels._set_channel_16bit_value(2, 10000)
360    # timeit_call(
361    #     "'_set_channel_16bit_value(0..2, 10000)'",
362    #     _test,
363    #     loop_count
364    # )
365    #
366    # def _test():
367    #     for i in range(PIXEL_COUNT * 3):
368    #         pixels._set_channel_16bit_value(i, 500)
369    # timeit_call(
370    #     "'_set_channel_16bit_value(for 0..{}, 10000)'"
371    #     "".format(PIXEL_COUNT * 3),
372    #     _test,
373    #     10
374    # )
375    print("    must be uncommented in code to work..")
376
377
378def timeit_pixels_get():
379    """Measure timing pixels get."""
380    print("*** pixels get:")
381
382    pixels.set_pixel_all((1, 11, 111))
383
384    def _test():
385        print("[", end="")
386        for i in range(PIXEL_COUNT):
387            print("{}:{}, ".format(i, pixels[i]), end="")
388        print("]")
389
390    timeit_call("'print('{}:{}, '.format(i, pixels[i]), end='')'", _test, 1)
391
392
393def time_measurement():
394    """Measure timing."""
395    print("meassure timing:")
396    timeit_pixels_show()
397    timeit_pixels_set_single()
398    timeit_pixels_set_loop()
399    timeit_pixels_set_all()
400    timeit_pixels_set_16bit()
401    timeit_pixels_set_float()
402    timeit_channel_set()
403    timeit_channel_set_internal()
404    timeit_pixels_get()
405    pixels.set_pixel_all((0, 1, 1))
406
407
408##########################################
409
410
411def test_bcdata():
412    """Test BC-Data setting."""
413    print("test BC-Data setting:")
414    print("set pixel all to 100, 100, 100")
415    pixels.set_pixel_all((100, 100, 100))
416    pixels.show()
417    time.sleep(2)
418    print(
419        "bcr: {:>3}\n"
420        "bcg: {:>3}\n"
421        "bcb: {:>3}\n"
422        "".format(
423            pixels.bcr,
424            pixels.bcg,
425            pixels.bcb,
426        )
427    )
428    # calculate bc values
429    Ioclmax = adafruit_tlc59711.TLC59711.calculate_Ioclmax(Riref=2.7)
430    print("Ioclmax = {}".format(Ioclmax))
431    Riref = adafruit_tlc59711.TLC59711.calculate_Riref(Ioclmax=Ioclmax)
432    print("Riref = {}".format(Riref))
433    BCValues = adafruit_tlc59711.TLC59711.calculate_BCData(
434        Ioclmax=Ioclmax,
435        IoutR=18,
436        IoutG=11,
437        IoutB=13,
438    )
439    # (127, 77, 91)
440    print("BCValues = {}".format(BCValues))
441
442    print("set bcX")
443    pixels.bcr = BCValues[0]
444    pixels.bcg = BCValues[1]
445    pixels.bcb = BCValues[2]
446    pixels.update_BCData()
447    pixels.show()
448    print(
449        "bcr: {:>3}\n"
450        "bcg: {:>3}\n"
451        "bcb: {:>3}\n"
452        "".format(
453            pixels.bcr,
454            pixels.bcg,
455            pixels.bcb,
456        )
457    )
458    time.sleep(2)
459
460
461##########################################
462
463
464def test_main():
465    """Test Main."""
466    print(42 * "*", end="")
467    print(__doc__, end="")
468    print(42 * "*")
469    # print()
470    # time.sleep(0.5)
471    # print(42 * '*')
472
473    pixels.set_pixel_all_16bit_value(1, 10, 100)
474    pixels.show()
475    time.sleep(0.5)
476
477    test_bcdata()
478    time.sleep(0.5)
479    print(42 * "*")
480
481    time_measurement()
482    time.sleep(0.5)
483    print(42 * "*")
484
485    offset = 0
486
487    print("loop:")
488    while True:
489        offset = channelcheck_update(offset)
490        time.sleep(0.5)
491        print(offset)
492
493
494##########################################
495# main loop
496
497if __name__ == "__main__":
498    test_main()

Single Chip Autoshow

This makes it very slow on lots of pixel changes but is convenient for only a handful of pixels.

examples/tlc59711_singlechip_autoshow.py
 1#!/usr/bin/env python3
 2# -*- coding: utf-8 -*-
 3# CircuitPython
 4
 5# SPDX-FileCopyrightText: 2021 s-light
 6# SPDX-License-Identifier: MIT
 7# Author Stefan Krüger (s-light)
 8
 9"""TLC5971 / TLC59711 Example."""
10
11__doc__ = """
12tlc59711_singlechip_autoshow.py - TLC59711AutoShow minimal usage example.
13
14simple demo of the TLC59711 16-bit 12 channel LED PWM driver.
15Shows the minimal usage - how to set pixel values.
16the TLC59711AutoShow class automatically writes the pixel values on each change.
17this makes it very slow on lots of pixel changs but is convenient for only a handfull of pixels..
18
19Author: Tony DiCola, Stefan Krueger
20
21Enjoy the colors :-)
22"""
23
24import board
25import busio
26
27import adafruit_tlc59711
28
29print(__doc__)
30
31# Define SPI bus connected to chip.
32# You only need the clock and MOSI (output) line to use this chip.
33spi = busio.SPI(board.SCK, MOSI=board.MOSI)
34pixels = adafruit_tlc59711.TLC59711AutoShow(spi)
35
36# Ways to set the values:
37# just a list or tuple with 3 integer values: R G B
38# each 0 - 65535 or 0.0 - 1.0
39# every chip has 4 RGB-LEDs (=12 Channel)
40pixels[0] = (100, 100, 10111)
41pixels[1] = (0, 0, 100)
42pixels[2] = (0.01, 0.0, 0.01)
43pixels[3] = (0.1, 0.01, 0.0)
44
45# You can also explicitly control each R0, G0, B0, R1, B1, etc. channel of the first ic
46# by getting and setting its 16-bit value directly with properties.
47# For example set channel 2 to 1/4 green (i.e. G2):
48pixels.g2 = 65535 // 4
49
50# there are a bunch of other advanced ways to set pixel.
51# have a look at the other examples.

Brightness Correction Data

Test brightness correction data (BC)

examples/tlc59711_simpletest.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4# simple demo of the TLC59711 16-bit 12 channel LED PWM driver.
 5# Shows the minimal usage - how to set pixel values in a few ways.
 6# Author: Tony DiCola
 7
 8import board
 9import busio
10
11import adafruit_tlc59711
12
13print("tlc59711_simpletest.py")
14
15# Define SPI bus connected to chip.
16# You only need the clock and MOSI (output) line to use this chip.
17spi = busio.SPI(board.SCK, MOSI=board.MOSI)
18pixels = adafruit_tlc59711.TLC59711(spi, pixel_count=16)
19
20# examples how to set the pixels:
21# range:
22# 0 - 65535
23# or
24# 0.0 - 1.0
25# every pixel needs a color -
26# give it just a list or tuple with 3 integer values: R G B
27
28# set all pixels to a very low level
29pixels.set_pixel_all((10, 10, 10))
30
31# every chip has 4 Pixels (=RGB-LEDs = 12 Channel)
32pixels[0] = (100, 100, 100)
33pixels[1] = (0, 0, 100)
34pixels[2] = (0.01, 0.0, 0.01)
35pixels[3] = (0.1, 0.01, 0.0)
36# if you are ready to show your values you have to call
37pixels.show()
38
39# there are a bunch of other ways to set pixel.
40# have a look at the other examples.

Fastset test

Showcases the usage of set_pixel_16bit_value for fastest setting of values.

examples/tlc59711_fastset.py
 1#!/usr/bin/env python3
 2# -*- coding: utf-8 -*-
 3# CircuitPython
 4
 5# SPDX-FileCopyrightText: 2021 s-light
 6# SPDX-License-Identifier: MIT
 7# Author Stefan Krüger (s-light)
 8
 9"""TLC5971 / TLC59711 Example."""
10
11__doc__ = """
12tlc59711_fastset.py - TLC59711 fast set example.
13
14showcases the usage of set_pixel_16bit_value for fastest setting of values.
15for speed comparision of all the available set calls
16look at the tlc59711_dev.py file.
17
18Enjoy the colors :-)
19"""
20
21
22import time
23
24import board
25import busio
26
27import adafruit_tlc59711
28
29
30##########################################
31PIXEL_COUNT = 16
32
33spi = busio.SPI(board.SCK, MOSI=board.MOSI)
34pixels = adafruit_tlc59711.TLC59711(spi, pixel_count=PIXEL_COUNT)
35
36
37##########################################
38# test function
39
40
41def channelcheck_update_pixel(offset):
42    """Channel check pixel."""
43    # print("offset", offset)
44
45    pixels.set_pixel_16bit_value(offset, 1000, 100, 0)
46    # clear last pixel
47    last = offset - 1
48    if last < 0:
49        last = PIXEL_COUNT - 1
50    pixels.set_pixel_16bit_value(last, 0, 0, 1)
51    pixels.show()
52
53    offset += 1
54    if offset >= PIXEL_COUNT:
55        time.sleep(0.2)
56        offset = 0
57        print("clear")
58        pixels.set_pixel_all_16bit_value(0, 1, 0)
59        pixels.show()
60    return offset
61
62
63def test_main():
64    """Test Main."""
65    print(42 * "*", end="")
66    print(__doc__, end="")
67    print(42 * "*")
68
69    bcvalues = adafruit_tlc59711.TLC59711.calculate_BCData(
70        Ioclmax=18,
71        IoutR=18,
72        IoutG=11,
73        IoutB=13,
74    )
75    print("bcvalues = {}".format(bcvalues))
76    pixels.bcr = bcvalues[0]
77    pixels.bcg = bcvalues[1]
78    pixels.bcb = bcvalues[2]
79    pixels.update_BCData()
80    pixels.show()
81
82    offset = 0
83
84    print("loop:")
85    while True:
86        offset = channelcheck_update_pixel(offset)
87        time.sleep(0.2)
88
89
90##########################################
91# main loop
92
93if __name__ == "__main__":
94    test_main()