Simultaneous LED Control - One LED On for 5 Seconds, Another LED Blinking 5 Times in Arduino
If you want both LEDs to operate simultaneously, with the first LED staying on for 5 seconds and the second LED blinking on and off 5 times during that period, you can use this code:
void setup() {
pinMode(10, OUTPUT); // First LED
pinMode(11, OUTPUT); // Second LED
}
void loop() {
// Turn on the first LED for 5 seconds
digitalWrite(10, HIGH);
// Blink the second LED 5 times
for (int i = 0; i < 5; i++) {
digitalWrite(11, HIGH);
delay(500);
digitalWrite(11, LOW);
delay(500);
}
digitalWrite(10, LOW); // Turn off the first LED
delay(1000); // Optional gap between cycles
}