Am strugling to re-create an algorithm fora neopixel sequence similar to this one:
As I am strugling since a few days on it, I am asking if someone help with a fresh new idea for the structure of the "for" loops that needs to be stacked in.
Here is a clearer explantion in text of the sequence to reproduce the effect of a slow left to right movement of 3 leds on an array of 7 sevens RGBW leds, using only the White from 0 to 255 in x steps (Number of steps and delay will be adjusted later).
first led slowly light on, and when at around 50% the next led starts increasing. and the previous start decreasing.
I get the idea, but it can be interpreted variously. Please draw a timing diagram. For an example, show the brightness of 3 LEDs from 0% to 100% on the vertical axis, time on the horizontal. Because, it's not clear about the desired phase relationship.
Does it "wrap around", i.e. circular behaviour? Have you considered the non-linear effect of LED gamma?
Yes you are right, I think doing this table will help. Let me come back with it, it makes me ask myslef the right questions.
As per the non-linear effect of LED gamma? For now I didn't taught about it, but you are certainly right I should consider it. Adafruit has a Gamma correction table, Is it a good way of solving this issue ?
Hi here a table as a starting point. I undersatnd that every % has to be converted due to gamma effect. Let's say that in the table it is the "visible" percentage.
Movement is one way,up to down (led 0 to 6) and again.
Just draw it once statically on the strip. Then with one call every time through loopjust shift the bits over by one. Copy one end, shift them all over by one, stuff the saved one on the beginning end. Done
Thank you, that is an excellent way to present it. Another really feasible idea that comes from this, is to embed the values in the table into a 2 dimensional array in the code. Then you just cycle through the rows, setting each LED to the value in the table. I see now that is rephrasing what was said by @jimLee above. Except, without bit shifting.
Secondly, you can do it algorithmically. Several steps are involved, but each value is no more than the result of the mathematical principle that you used to construct your table. You are constructing a model - look for commonalities... hey, the brightness profiles are all the same, only difference is the time offset. Well there is something you can work with mathematically. They're also linear, hint hint.
The visual effect of brightness will not be uniform (i.e. as linear as expected) as you may expect from the raw percentage illumination values in your table. I'm referring to gamma compensation. I used it and it made a huge improvement. But you can try and see.
Sorry, you asked about the Adafruit gamma compensation, but I'm not familiar with it. I use an optimized low level method that would just confuse the discussion now.
Actually, I cheat a little. I use colorObj for NeoPixels, TFTs, OLEDs, RGB LEDs etc. colorObj can be blended with other colors, like black, to make other or darker colors. etc. Also, this supplies color mappers as well. like map() functions for color.
That may not be really necessary, since it's for the same project. The normal forum protocol is to continue such topics in the same thread.
Most gamma correction uses exponentiation. Inverse gamma (i.e. correction) raises the input data to a power, for example, monitor gamma is usually 2.2. The idea I clicked to, is that 2.0 is close to 2.2, and if precise gamma is not required (for colour matching for example) then you can use the power 2.0 but that is a mathematical square. So I exploit the native integer multiplication on many processors (or accept the "pretty fast" inline code) to simply multiply the input byte by itself, and then scale it down to a byte again.