Hello everyone, i am a very novice user trying to program a light show. i was able to get each “scene” individually to work, but when i try to bring it all together and run it as a loop it is not working as expected. Can someone please help me out and point me in the right direction.
The light show should move between colors, then move to blue white with glitter, then a moving red, green and white pattern. right now the colors are flashing on and off, then blue white with glitter is working, the red green and white are not moving as expected. https://www.youtube.com/watch?v=MYk8oYFKGTo
And then please edit your post here, deleting all the code in your G+ post and just share a link to your code at http://gist.github.com
(Code does not always display properly here in G+ and is hard to read on some mobile devices. Plus line numbers can be referenced in discussion with the gist code.)
If your NUM_LEDS is 200, that means you should only be addressing pixels leds[0] up to leds[199]. If you try to write data to a pixel that does not exist bad things happen (in memory) and things can look all wrong! In your case you have leds[200] in several places. Can’t do that.
Also in your RGW function your have leds[i+ some number] that will end up adding to a number larger then [199], which will again break things. Make some corrections and put the updated code http://gist.github.com and we can go from there as needed.
@Kyle_bostick
Also, here’s some examples that you might check out to help simplify your coding. Since you have color patterns that repeat you can do things with a few for loops instead of typing out all those led[x] lines.
Thank you Marc! i made those changes, and no longer have the count at 200 and it is working much better! It will cycle properly to the Red White and Green stage, it will move through that stage but it doesn’t look the way i expected. I assume it also has to do with the count.
Hey Marc, I am reviewing the code examples and really like this one
I would like to pick the colors it cycles between, but see the code shows “uint8_t hue;” and am wondering how i can select 6 specific colors to cycle between and add in the same pattern
Please edit your second post and delete all that code. It is painful to scroll through all that on a phone.
Your RGW function is still breaking things because as soon as i = 2 or greater it will be trying to send data to pixels that don’t exist. See line 1508 in your code, where i=2+198 would be beyond your last pixel (when NUM_LEDS is 200).
@marmil I removed the code comment. And ok I understand the issue, but do not know how to fix it. Would it be easier to email directly? I can send you my email. Also I have an addition question about timing. My goal for this show was to have the the show move through the C9 colors for ten seconds, then move to the Blue white with Glitter for 10 seconds, then move to the Red White and Green for 10 and start over. I currently have it set to 3 seconds and know how to change it. but I want the C9 colors to cycle faster i do not know the best way to cycle that pattern so i wrote each one as a pattern instead of 1 pattern that cycles the colors properly. Lastly the code you examples you sent me are helpful for understanding how it moves through the patterns. I would like to use patterns with specific colors and see all most all examples use a random function. How can I set specific colors in a pattern like this? Again thank you so much for the help. if you want i can send a “donation” for your time
for the C9 colors what I am trying to do is cycle these colors leds[0] = CRGB::White;
leds[1] = CRGB::Red;
leds[2] = CRGB::Green;
leds[3] = CRGB(255,40,0);
leds[4] = CRGB::Blue;
leds[5] = CRGB(255,150,0);
so it rotates between these colors as a pattern. The only way I could figure it out was to assign each LED the color and then after it displays that color change it with a new pattern. So if there is a way to create a function that rotates all LEDs between the 6 colors Thats all I want. Then i can use that function for 10 seconds, the Blue white is working as expected, then I need to figure out how to fix the Red White and Green display
Cycling through a specific set of colors could be handled a number of ways. Some ideas for you investigate might be using a switch case, an array of colors you sequentially select from, or running a pattern that in turn cycles between several other predefined patterns.
Okay ill work on that! do you have an idea on how i can fix the other part of the code for the Red White and Green moving LEDs? I know the count goes too high, but how can i correct it so it moves through all the LEDs?