hey everyone..im busy with an IR control project for led downlights and ive hit a problem...is there any way to for example flash leds in sequence while running the IR decode code without interfering with each others timing? its hard to explain but heres my code
#include <IRremote.h>
const int IRR = 2; //IR Receiver
const int SPK = 3; //Speaker (PWM)
const int PWR = 5; //Power LED
const int SIG = 6; //Signal LED
const int ALL = 9; //Blue LED On All Lights
const int DL1 = 4; //Down Light 1
const int DL2 = 7; //Down Light 2
const int DL3 = 8; //Down Light 3
const int DL4 = 12; //Down Light 4
int state;
int val = 0;
int thres = 210;
int cycle = 1;
int count = 0;
IRrecv irrecv(IRR);
decode_results results;
void setup(){
Serial.begin(9600);
irrecv.enableIRIn(); // Starts the receiver
pinMode(DL1, OUTPUT);
pinMode(DL2, OUTPUT);
pinMode(DL3, OUTPUT);
pinMode(DL4, OUTPUT);
}
void loop(){
//decodes the infrared input
if (irrecv.decode(&results)){
switch (results.value){
case -516040152:
state = digitalRead(4);
digitalWrite(DL1, !state);
delay(150);
break;
case 2908251746:
state = digitalRead(7);
digitalWrite(DL2, !state);
delay(150);
break;
case 657459652:
state = digitalRead(8);
digitalWrite(DL3, !state);
delay(150);
break;
case 4120482440:
state = digitalRead(12);
digitalWrite(DL4, !state);
delay(150);
break;
default:
Serial.println("Invalid Command");
delay(150);
}
irrecv.resume();
}
}
now how would i add for example a 4 led chase with a one second delay...thanks in advance!!