Go Down

Topic: Arduino and VixenLights programming issue (Read 867 times) previous topic - next topic


Jan 21, 2013, 03:15 am Last Edit: Jan 21, 2013, 04:49 am by umobie Reason: 1
I am building a arduino based light control system using VixenLights.  Everything is working but in reverse.  I have a POST test that runs through every light at starup and that works fine but in my loop() It seems when Vixen starts it makes all the lights go on, and when I mark sections in vixen to turn lights on it turns them off.  I just need the system to work exactly opposite of the way it is.

Thanks in advance

Code: [Select]

int Channel_Count = 16;
int Pin_Offset = 2;

void setup(){

   for (int channel_index=Pin_Offset; channel_index < Channel_Count + Pin_Offset; channel_index++)
       pinMode(channel_index, OUTPUT); //set the pin mode for each channel
       //POST test the channels to see if they are all working
       //this works fine
       analogWrite(channel_index, 0); //turn channel at [channel_index] on
       delay(250); // wait
       analogWrite(channel_index, 255); //turn channel at [channel_index] off

   Serial.print("System Ready");
   turn_all_lights_off(); //All the lights come on by default, turn them off

void loop()
   if (Serial.available() >= Channel_Count)
     //for some reason after this point all the lights are on and vixen turns them off
     //I need for the lights to be off and vixen to turn them on as initiated by the program
       for (int channel_index=Pin_Offset; channel_index < Channel_Count + Pin_Offset; channel_index++)
           analogWrite(channel_index, Serial.read());
       Serial.println("System Ready");

//Force all the lights off
void turn_all_lights_off()
 for(int channel_index=Pin_Offset;channel_index<Channel_Count + Pin_Offset;channel_index++){
   analogWrite(channel_index, 255);

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131