View Full Version : Background Sequence
mikeh65
12-07-2010, 10:54 PM
Alright, like some of you, now that your shows are up and running, I'm already thinking about next year. I have had an idea for a Christmas Wreath, wire frame plan attached. It will be 3ft across and made entirely our of lights. Much like a leaping light arch. All green lights with a red bow made out of rope lights. The plan was to make it in 12 channels for the green lights and one for the bow. Ok, so I would have twelve sections like a clock. So I thought why not a clock. What I want to do is, when my show is over, have a background sequence or program start, look at the time and display it on the wreath. Then it will update and change on the fives. The questions is, how? Besides writing a sequence that is 12 hours long. Does anyone have any ideas? Your help would be appreciated.
AchillesPDX
12-09-2010, 06:19 PM
Sounds like something that would be pretty easy to work up in the scripting language, if it was properly documented somewhere. The single Wiki page is pretty lame. I wish I was versed in C# so I could help...
Gebbinn
12-09-2010, 11:40 PM
Ok, edit 1.
To make a clock like you are saying, basically you will have a clock with only a minute hand, and that hand will only update every 5 minutes.
That seems a bit off. So, to make this work like you are suggesting, you would need really 24 channels. one set of 12 for the hour, and one set of 12 for the minute, which again will only be accurate to within 5 minutes.
A true clock would require 60 channels for minutes, plus 12 for hours, and if you were truly fancy, another 60 for the seconds, but lets forgo that and just assume 60 channels for minutes.
I could script either of these scenarios. Right now I am working on a 24 channel clock background sequence.
Ok, it took some serious work to figure this out. My original Idea didn't work out. For some reason, they took the IF/ElseIF out of C# and forgot to send me the memo. But a bit of perseverance and I got it figured out. Anyway... here is the code I have come up with. I cannot test this code for you, since I only have 6 channels right now. I commented the heck out of it so hopefully you understand what I was doing. This code compiles in Vixen with no errors however.
void Start() {
//Created by Gebbinn for DoItYourselfChristmas.com
//If you use this code, please give credit where credit is due.
//This code is designed to create a simple clock that is accurate to the
//nearest 5 minutes. It requires 24 channels, 12 for the hour and 12 for the minute
//Feel free to change the code to suit your purposes.
//I need more lights... I need more lights... I need more lights.
// For this program, I named the channels for the wreath as follows.
// WreathMinuteChan1 , WreathMinuteChan2, WreathMinuteChan3 and so on.
// WreathHourChan1, WreathHourChan2, WreathHourChan3, and so forth.
Off(All);
int minutes;
int hours;
DateTime now = DateTime.Now; //get the current time
//The DateTime constructor goes (YYYY, MM, DD, HH, MM, SS)
//Change the following lines to determine the start and end point
//of when you want the Background script to run.
//Here we are running from 5:30 pm until 11:00 pm
DateTime start = new DateTime(now.Year, now.Month, now.Day, 17, 30, 00);
DateTime end = new DateTime(now.Year, now.Month, now.Day, 23, 00, 00);
//We only want the channels to turn on while the current time is
//between 5:30 and 11 pm
while (now.CompareTo(start) >= 0 && now.CompareTo(end) <= 0)
{
//We know that the Integer "now" is holding the current time. We only care right now
//about the hour hand. So lets make our hour hand work.
hours = now.Hour;
switch(hours)
{
case 1:
On (WreathHourChan1, At (100));
break;
case 2:
On (WreathHourChan2, At (100));
break;
case 3:
On (WreathHourChan3, At (100));
break;
case 4:
On (WreathHourChan4, At (100));
break;
case 5:
On (WreathHourChan5, At (100));
break;
case 6:
On (WreathHourChan6, At (100));
break;
case 7:
On (WreathHourChan7, At (100));
break;
case 8:
On (WreathHourChan8, At (100));
break;
case 9:
On (WreathHourChan9, At (100));
break;
case 10:
On (WreathHourChan10, At (100));
break;
case 11:
On (WreathHourChan11, At (100));
break;
case 12:
On (WreathHourChan12, At (100));
break;
default:
Off (All);
break;
}
//The integer "now" is still holding the current time, now we need to turn on the minute hand
//Since we are only using 12 channels for the minute hand, we have to divide by 5
//This will determine which minute hand is to turn on.
//sets the minute integer to current minutes divided by 5
//Dont code at 1 a.m. you make errors. C# will truncate the value of minutes and round down anyway
// So all we should need to do is the following
minutes = ( ((now.Minute) / 5 )+1) ;
//Now turn on the minute hand
switch(minutes)
{
case 1:
On (WreathMinuteChan1, At (100));
break;
case 2:
On (WreathMinuteChan2, At (100));
break;
case 3:
On (WreathMinuteChan3, At (100));
break;
case 4:
On (WreathMinuteChan4, At (100));
break;
case 5:
On (WreathMinuteChan5, At (100));
break;
case 6:
On (WreathMinuteChan6, At (100));
break;
case 7:
On (WreathMinuteChan7, At (100));
break;
case 8:
On (WreathMinuteChan8, At (100));
break;
case 9:
On (WreathMinuteChan9, At (100));
break;
case 10:
On (WreathMinuteChan10, At (100));
break;
case 11:
On (WreathMinuteChan11, At (100));
break;
case 12:
On (WreathMinuteChan12, At (100));
break;
default:
Off (All);
break;
}
//update the current time
now = DateTime.Now;
}
Off(All);
}
ptone
12-10-2010, 09:46 AM
I'm NOT a C# person (Python), but a couple questions:
in vixen BG scripts - do the lights auto off on each loop, or do you have to specifically turn them off?
Also unless C# is different than most languages Math.ceiling will return a value, not alter the variable in place.
-Preston
Gebbinn
12-10-2010, 10:46 AM
your right about the math.ceiling. I fixed the problem in the code. Thanks for the catch. Don't code at 1 a.m. You are bound to miss things, like the fact that minutes is an integer, and does not need to be rounded... c# will automatically parse the value and round down to the nearest whole number, therefore just add a 1 and go back to bed LOL.
As for the state vixen leaves channels in... I was just making an assumption of a renard controller... which will leave the lights in the state they were last assigned until a new signal is input from what I understand.
mikeh65
12-15-2010, 01:04 AM
Wow, this is more then I expected. Thanks. Once question. I am only planning a 12 channel wreath. But looking at you script can this be done. To indicate a separation between hour and minutes, how about running the minutes at 50% on or maybe 66%. This way I can use less channels and don't have to figure out how to get twice as many light on the same wreath.
Thanks again.
Pyrotech
12-16-2010, 09:11 AM
Aside from using basic many many years ago not a programmer, but it seems mathematically at least possible to do it on 12 channels. First find hour, assign to channel, then calculate minutes, divide by five, ignore remainder, channel = whole integer +1, if hours n equals minutes n , minutes = no channel or as suggested hours have one intensity minutes have another and can be summed.
Gebbinn
12-16-2010, 07:50 PM
Well, I suppose it is possible to use a dimming technique for the minutes, but the problem you have is wether those who are looking on to the display need to understand what you are doing. With the dimming of the minutes, unless you watch the display for long enough to figure it out, then its going to appear that your display is broken, with one channel working properly, one channel kinda working and the rest not working.
You can do it with dimming... it would be a simple matter of changing the intensity of the minutes in the code.. IE....
//take these lines...where the # is the channel number
On (WreathMinuteChan#, At (100));
//and change them to this
On (WreathMinuteChan#, At (66));
You would also need to do like Pyro said, and compare minutes to hours and if minutes = hours then do nothing. Right off the top of my head, I know it can be done, I just have to look into the syntax. I will look that up later and edit my post for you. I have not been programming for years so I have to go back and research this stuff, but its what I love doing.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.