Thanks in advance
Code:
int Channel_Count = 16;
int Pin_Offset = 2;
void setup(){
Serial.begin(57600);
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);
}
}