OK, I can't use the sleep function because I am using ALL of the digital pins as outputs. Here is my code.
int INDICATOR = 13; // choose the pin for power indicator
int CH1 = 0; // choose the pin for CH1
int CH2 = 1; // choose the pin for CH2
int CH3 = 2; // choose the pin for CH3
int CH4 = 3; // choose the pin for CH4
int CH5 = 4; // choose the pin for CH5
int CH6 = 5; // choose the pin for CH6
int CH7 = 6; // choose the pin for CH7
int CH8 = 7; // choose the pin for CH8
int CH9 = 8; // choose the pin for CH9
int CH10 = 9; // choose the pin for CH10
int CH11 = 10; // choose the pin for CH11
int CH12 = 11; // choose the pin for CH12
int RELAY = 12; // choose the pin for RELAY
int BUTTON = 14; // choose the input pin (for a pushbutton)
int val = 0; // variable for reading the pin status
void setup() {
pinMode(INDICATOR, OUTPUT); // declare INDICATOR as output
pinMode(CH1, OUTPUT); // declare CH1 as output
pinMode(CH2, OUTPUT); // declare CH2 as output
pinMode(CH3, OUTPUT); // declare CH3 as output
pinMode(CH4, OUTPUT); // declare CH4 as output
pinMode(CH5, OUTPUT); // declare CH5 as output
pinMode(CH6, OUTPUT); // declare CH6 as output
pinMode(CH7, OUTPUT); // declare CH7 as output
pinMode(CH8, OUTPUT); // declare CH8 as output
pinMode(CH9, OUTPUT); // declare CH9 as output
pinMode(CH10, OUTPUT); // declare CH10 as output
pinMode(CH11, OUTPUT); // declare CH11 as output
pinMode(CH12, OUTPUT); // declare CH12 as output
pinMode(RELAY, OUTPUT); // declare RELAY as output
pinMode(BUTTON, INPUT); // declare pushbutton as input
}
void loop(){
digitalWrite(INDICATOR, LOW); // turn INDICATOR on
val = digitalRead(BUTTON); // read input value
if (val == LOW) { // check the input state
digitalWrite(CH1, LOW); // turn CH1 OFF
digitalWrite(CH2, LOW); // turn CH2 OFF
digitalWrite(CH3, LOW); // turn CH3 OFF
digitalWrite(CH4, LOW); // turn CH4 OFF
digitalWrite(CH5, LOW); // turn CH5 OFF
digitalWrite(CH6, LOW); // turn CH6 OFF
digitalWrite(CH7, LOW); // turn CH7 OFF
digitalWrite(CH8, LOW); // turn CH8 OFF
digitalWrite(CH9, LOW); // turn CH9 OFF
digitalWrite(CH10, LOW); // turn CH10 OFF
digitalWrite(CH11, LOW); // turn CH11 OFF
digitalWrite(CH12, LOW); // turn CH12 OFF
digitalWrite(RELAY, LOW); // turn RELAY OFF
} else {
digitalWrite(CH1, HIGH); // sets CH1 on
delay(500); // waits for 0.5 second
digitalWrite(CH1, LOW); // sets CH1 off
delay(2000); // waits for 2 seconds
digitalWrite(CH2, HIGH); // sets CH2 on
delay(500); // waits for 0.5 second
digitalWrite(CH2, LOW); // sets the CH2 off
delay(2000); // waits for 2 seconds
digitalWrite(CH3, HIGH); // sets CH3 on
delay(500); // waits for 0.5 second
digitalWrite(CH3, LOW); // sets the CH3 off
delay(2000); // waits for 2 seconds
digitalWrite(CH4, HIGH); // sets CH4 on
delay(500); // waits for 0.5 second
digitalWrite(CH4, LOW); // sets CH4 off
delay(2000); // waits for 2 seconds
digitalWrite(CH5, HIGH); // sets CH5 on
delay(500); // waits for 0.5 second
digitalWrite(CH5, LOW); // sets CH5 off
delay(2000); // waits for 2 seconds
digitalWrite(CH6, HIGH); // sets CH6 on
delay(500); // waits for 0.5 second
digitalWrite(CH6, LOW); // sets CH6 off
delay(2000); // waits for 2 seconds
digitalWrite(CH7, HIGH); // sets CH7 on
delay(500); // waits for 0.5 second
digitalWrite(CH7, LOW); // sets CH7 off
delay(2000); // waits for 2 seconds
digitalWrite(CH8, HIGH); // sets CH8 on
delay(500); // waits for 0.5 second
digitalWrite(CH8, LOW); // sets CH8 off
delay(2000); // waits for 2 seconds
digitalWrite(CH9, HIGH); // sets CH9 on
delay(500); // waits for 0.5 second
digitalWrite(CH9, LOW); // sets CH9 off
delay(2000); // waits for 2 seconds
digitalWrite(CH10, HIGH); // sets CH10 on
delay(500); // waits for 0.5 second
digitalWrite(CH10, LOW); // sets CH10 off
delay(2000); // waits for 2 seconds
digitalWrite(CH11, HIGH); // sets CH11 on
delay(500); // waits for 0.5 second
digitalWrite(CH11, LOW); // sets CH11 off
delay(2000); // waits for 2 seconds
digitalWrite(CH12, HIGH); // sets CH12 on
delay(500); // waits for 0.5 second
digitalWrite(CH12, LOW); // sets CH12 off
digitalWrite(RELAY, HIGH); // sets RELAY on
delay(2000); // waits for 2 seconds
digitalWrite(CH1, HIGH); // sets CH1 on
delay(500); // waits for 0.5 second
digitalWrite(CH1, LOW); // sets CH1 off
delay(2000); // waits for 2 seconds
digitalWrite(CH2, HIGH); // sets CH2 on
delay(500); // waits for 0.5 second
digitalWrite(CH2, LOW); // sets CH2 off
delay(2000); // waits for 2 seconds
digitalWrite(CH3, HIGH); // sets CH3 on
delay(500); // waits for 0.5 second
digitalWrite(CH3, LOW); // sets CH3 off
delay(2000); // waits for 2 seconds
digitalWrite(CH4, HIGH); // sets CH4 on
delay(500); // waits for 0.5 second
digitalWrite(CH4, LOW); // sets CH4 off
delay(2000); // waits for 2 seconds
digitalWrite(CH5, HIGH); // sets CH5 on
delay(500); // waits for 0.5 second
digitalWrite(CH5, LOW); // sets CH5 off
delay(2000); // waits for 2 seconds
digitalWrite(CH6, HIGH); // sets CH6 on
delay(500); // waits for 0.5 second
digitalWrite(CH6, LOW); // sets CH6 off
delay(2000); // waits for 2 seconds
digitalWrite(CH7, HIGH); // sets CH7 on
delay(500); // waits for 0.5 second
digitalWrite(CH7, LOW); // sets CH7 off
delay(2000); // waits for 2 seconds
digitalWrite(CH8, HIGH); // sets CH8 on
delay(500); // waits for 0.5 second
digitalWrite(CH8, LOW); // sets CH8 off
delay(2000); // waits for 2 seconds
digitalWrite(CH9, HIGH); // sets CH9 on
delay(500); // waits for 0.5 second
digitalWrite(CH9, LOW); // sets CH9 off
delay(2000); // waits for 2 seconds
digitalWrite(CH10, HIGH); // sets CH10 on
delay(500); // waits for 0.5 second
digitalWrite(CH10, LOW); // sets CH10 off
delay(2000); // waits for 2 seconds
digitalWrite(CH11, HIGH); // sets CH11 on
delay(500); // waits for 0.5 second
digitalWrite(CH11, LOW); // sets CH11 off
delay(2000); // waits for 2 seconds
digitalWrite(CH12, HIGH); // sets CH12 on
delay(500); // waits for 0.5 second
digitalWrite(CH12, LOW); // sets CH12 off
digitalWrite(RELAY, LOW); // sets RELAY off
}
}
Any other suggestions are welcome but I think I may be out of luck. One other condition, this is triggered by a remote receiver and only applies the 5v for a little less than .5 sec. So, I can't hold the button to run the sequence.
Sean