Blink second LED after a few cycles of LED1

Hi all,

how do i write a function to say after a few loops turn another led on? i.e. if the LED blinks 5 times turn LED1 on to run simultaneously.

void setup() {
Serial.begin(115200); // Initialise Serial to 115200
pinMode(vibration_Sensor, INPUT);
pinMode(LED, OUTPUT);
pinMode(LED1, OUTPUT);
}

/*

  • main_loop
    */

void loop() {

previous_condition = present_condition;
present_condition = digitalRead(A5); // Reading digital data from the A5 Pin of the Arduino.

if (previous_condition != present_condition) {
led_blink();

} else {
digitalWrite(LED, OFF);
//Serial.println (" LED is OFF ");

}
void led_blink(void) {
digitalWrite(LED, ON);
delay(250);
digitalWrite(LED, OFF);
delay(250);
digitalWrite(LED, ON);
delay(250);
digitalWrite(LED, OFF);
delay(250);
}

Moved your topic to it's current location as it is more suitable.

Could you take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

Just count how many times your code executes the blink function. Use a global variable which is increased inside the blink function. Then add an if statement in your loop to test if the counter got higher than your threshold value (5 for example).