I am working on the cake topper for my wedding, and I am trying to make my Adafruit Neopixel Rings activate a few seconds after my music file on the file on my sound shield starts playing. I modified the example code to what I wanted it to be and it works great when I upload it to my arduino.
But when I try to insert it into my larger file I keep getting a few error codes, most notably "'rainbow' was not declared in this scope". I rooted around for a while, it appears to be defined just as it is in the working file, but I cant seem to get it to work. Can anyone take a look and show me what simple thing I am missing to make this work?
The problem keeps popping up at the "//Sillohette Lights:-----" right under the music player.
As a first step in debugging the problem by Auto Formatting your code. It will report that you have too many right curly braces.
Now to track down what is wrong. Place the cursor to the right of an opening brace and the IDE will indicate the matching brace by placing a box round it. Check each pair of braces, such as those starting and ending functions, loops, if blocks etc until you find the problem. Start with the opening brace of the loop() function. The IDE matches it to the line }//end of music
You may find that the structure of the program is easier to see if each opening and closing brace is placed on its own line. The structure is even easier to see when the code is indented consistently.
At the last wedding I went to, there was a beautiful cake. Fancy decorations, on discs of styrofoam. Obviously, it was a prop only, and they didn't even serve cake.
Ok. So, I looked at the Demo of merging the sketches together and got it to work ok. The problem is I need the lights to go with the music rather than start playing after it. So according to the Adafruit example the place to put it is right in the same brackets at the while music section. When I insert the rainbow and rainbow cycle I keep getting the "not declared in this scope" error code. I'm not sure what to do in this particular case. Should I make a new void loop cycle inside the music code?
I can't easily figure out how things work within your program but I strongly suspect you liberal (very liberal) use of the delay() function is the main problem.
Get rid of ALL the delay()s and use the technique for timing in the Blink Without Delay example sketch. This demo several things at a time is an extended example of the technique.
The demo also illustrates how you can make the logic of your code easier to follow by using short functions with meaningful names.
Ok, so I got rid of all the delays but the problem is still popping up. I tried to modify the example you gave me Robin, but I'm not sure how to incorporate the music. Im going to try and put it into its own loop in a manner similar to the "merging several things into a single code" and what you have in this demo.
At the last wedding I went to, there was a beautiful cake. Fancy decorations, on discs of styrofoam. Obviously, it was a prop only, and they didn't even serve cake.