unsigned long prev_time =0;
unsigned long curr_time =0;
unsigned long prev_time1 =0;
unsigned long curr_time1 =0;
int led_pin1 = 2;
int led_pin2 = 8;
//Time delays-------------------------
int ton1=1000;
int toff1=2000;
int ton2=2000;
int toff2=5000;
void setup() {
Serial.begin(9600);
pinMode (led_pin1 ,OUTPUT);
pinMode (led_pin2, OUTPUT);
prev_time = millis();
digitalWrite(led_pin1,HIGH);
digitalWrite(led_pin2,HIGH);
}
void loop() {
//FOR BULB 1------------------------------------
curr_time =millis();
if((curr_time-prev_time)> ton1){
digitalWrite(led_pin2,LOW);}
if((curr_time-prev_time)> ton1+toff1){
digitalWrite(led_pin2,HIGH);
prev_time = curr_time;
}
//For bulb 2 ----------------------------------------------
curr_time1 =millis();
if((curr_time1-prev_time1)> ton2){
digitalWrite(led_pin1,LOW);}
if((curr_time1-prev_time1)> ton2+toff2){
digitalWrite(led_pin1,HIGH);
prev_time1 = curr_time1;
}
}