Mini Stage Show x 20

Tom-Kristensen:
My basic question is how do I set out my scene commands? If each change must be listed sequentially then I would need to rank commands by increasing values of ctr + 1.

Correct. I did mention that "timings must be in sequential order". Going back to my spreadsheet idea for laying out the scene it shouldn't be too hard to handle, and you can always sort the rows of commands based on the time. Practically, if you tried laying out your scene in a non-sequential order I think you'd go batty trying to arrange everything.

Tom-Kristensen:
The first command is effectively the unsigned int scene which sets out the time delay for each led before it is turned on, does this mean I cannot program a change till the int scene has fully played out?

Just to get the nomenclature correct, scene[] is an array (a list) of unsigned ints. As an aside, an unsigned int is 0 to 65535 -- this has the repercussion that you cannot have actions occurring past the 65.536 second mark without changing to a different data type.

I'm not sure what you mean by "being unable to program a change". My understanding is that you would program this scene for the box and then ship it off so multiple visitors could play the 60 second script over and over. If you need to change the scene you'll need to pull it out and reprogram it with your computer.

If, on the other hand, you were confused by the "time delay" you should rather think of it as when the action occurs -- "when" being based from the start of the scene. It doesn't specify a duration, but rather just what happens at that moment in time. You effectively set the duration by later adding another command to change the state of the LED (turn it back off, dim it slightly, etc.). It's just like managing kids; you have to tell them they can watch TV at 8pm and later tell them to stop watching TV at 9pm. If you tried telling them at 8pm that they can watch TV for an hour... well that just never works. That would require more advanced kids (or a more advanced program).

Tom-Kristensen:
To be honest i have no idea where or how to plug my change values into the code set-up. A small piece of example code for a couple of changes would probably help me out.

Crack open a spreadsheet and label the spreadsheet columns A, B, and C "light circuit", "time", and "brightness":

Circuit	Time	Brightness
		
LED1	0	255
LED2	0	255
LED3	0	255
LED1	1000	0
LED2	2000	0
LED3	3000	230
LED3	3100	205
LED3	3200	180
LED3	3300	155
LED3	3400	130
LED3	3500	105
LED3	3600	80
LED3	3700	55
LED3	3800	30
LED3	3900	5
LED3	4000	0

Going over again how this works, just read the list from top to bottom. E. g. at time 0 LED1 is set to 255 brightness, also at time 0 LED2 is set to 255 brightness... etc.

Now take those numbers and turn them into one long line separated by commas (hint: export to CSV and modify with a text editor)

LED1,0,255,LED2,0,255,LED3,0,255,LED1,1000,0,LED2,2000,0,LED3,3000,230,LED3,3100,205,LED3,3200,180,LED3,3300,155,LED3,3400,130,LED3,3500,105,LED3,3600,80,LED3,3700,55,LED3,3800,30,LED3,3900,5,LED3,4000,0

Finally, wrap them with all the program stuff:

unsigned int scene[] PROGMEM {LED1,0,255,LED2,0,255,LED3,0,255,LED1,1000,0,LED2,2000,0,LED3,3000,230,LED3,3100,205,LED3,3200,180,LED3,3300,155,LED3,3400,130,LED3,3500,105,LED3,3600,80,LED3,3700,55,LED3,3800,30,LED3,3900,5,LED3,4000,0};

Now paste that into the Arduino sketch, replacing the existing scene[] line. Upload it to the Arduino... done. And always correct the first time of course :wink: