I found this code and it seems to kind of do what I want , but I have not figured out how to make one stay on and the other cycle.
Also I am trying to figure out how to only start the process if the beam is broken for "x" time
/*
January 28, 2014
[author] Mark Graziano
mark.graziano.13@gmail.com
[instructables profile] http://www.instructables.com/member/GraziCNU/
*/
int LEDArray[] = {13, 10}; // LED array
int numOfLEDs = 2; // LEDs of index 0-3
int pirState = LOW;
int pirVal = 0;
int pirPin = 7;
void setup() {
pinMode(pirPin, INPUT);
int i;
for(i = 0; i < numOfLEDs; i++) {
pinMode(LEDArray*, OUTPUT);*
- }*
}
void loop() { - pirVal = digitalRead(pirPin);*
- int i;*
- //if motion is captured, light the LEDs in sequence*
- if (pirVal == HIGH) {*
- for (i= 0; i < numOfLEDs; i++) {*
_ analogWrite(LEDArray*, 255);_
_ delay (10000);_
_ }_
_ delay (1000);_
_ for (i= 0; i < numOfLEDs; i++) {_
_ analogWrite(LEDArray, 0);
delay (1000);
}
if (pirState == LOW) {
pirState = HIGH;
}
}
//else, set all LED values to zero*
* else {
analogWrite(LEDArray[0], 0);
analogWrite(LEDArray[1], 0);
if (pirState == HIGH) {
pirState = LOW;
}
}
}*_