0

Adafruit LED animation library - format for color
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit LED animation library - format for color

by Rcayot on Sun Jan 10, 2021 10:03 pm

Since this long post did not garner any help.
viewtopic.php?f=60&t=173877

I will try it this way.

What is the color format (packed integer, list, tuple..... other?)

that the 'colorwheel' call in all of the animation libraries?

I am trying to writw my own colorwheel function and keep getting the following error:

File "code.py", line 93, in <module>
File "adafruit_led_animation/animation/rainbowsparkle.py", line 83, in __init__
File "adafruit_led_animation/animation/rainbow.py", line 77, in __init__
File "adafruit_led_animation/animation/rainbowsparkle.py", line 93, in generate_rainbow
File "adafruit_led_animation/animation/rainbow.py", line 84, in generate_rainbow
MemoryError: memory allocation failed, allocating 1024 bytes

code.py contains a typical led animation that works quite well, except when I substitute my own 'colorwheel' function that gets called.

My take is that the format that is returned by the function is not what these animation functions are expecting. Any help would be welcome.

Roger

Rcayot
 
Posts: 99
Joined: Sat Feb 08, 2020 6:48 pm

Re: Adafruit LED animation library - format for color

by adafruit_support_carter on Mon Jan 11, 2021 1:31 pm

The version built into the CircuitPython firmware returns an integer:
https://circuitpython.readthedocs.io/en ... colorwheel
with the format:
the red, green and blue values are packed into the lower three bytes (0xRRGGBB)


The fall back version in the animation library returns a tuple:
https://github.com/adafruit/Adafruit_Ci ... or.py#L111
of format (R,G,B) where each value is 0 to 255.

adafruit_support_carter
 
Posts: 18190
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit LED animation library - format for color

by Rcayot on Tue Jan 12, 2021 12:03 pm

thank you.

I think I can work with that. I finally got the call to colorwheel to not give an error, but it only goes through 256 iteratiosn and then stops. I will work on it some more and then if still having trouble will come back.

Thanks again,

Roger

Rcayot
 
Posts: 99
Joined: Sat Feb 08, 2020 6:48 pm

Please be positive and constructive with your questions and comments.