How to change loop or create a second loop

Hi. I'm new at arduino and programming :slight_smile: I wanna to learn it so i wrote a simple digital output for two leds to blink on and off in 1 second delay. I wanna add a third led to blink independent on those two in loop, but i don't know how to do it :~

Tnx for help in advance :slight_smile:

How to use this forum

We would have to see your code. Please, post it in code tags.

There's a very simple example of how to blink a LED without using "delay()" in the examples in the IDE.
You can extend the technique to several LEDs, but I advise you to start with just two.

int led1 = 0;
int led2 = 1;
int led3 = 2; 

void setup()
{
  pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
}

void loop()
{
  digitalWrite(led1, HIGH);
  delay(1000);
  
  digitalWrite(led1, LOW);
  
  digitalWrite(led2, HIGH);
  delay(1000);
  
  digitalWrite(led2, LOW);
  delay(1000);
  digitalWrite(led3, HIGH);
  digitalWrite(led3, LOW);
}

Please edit that post, select the code and click the code tag button (# above the smileys)

Have you looked at the BlinkWithoutDelay example as suggested ?

Use of delay will prevent you doing what you're trying to do. AWOL's advice will take you right to the solution though.

Tnx for answers! Awol i don't understand what u mean with: without using "delay()" in the examples in the IDE. I just delete delay(); or how? Sorry i'm newbe :slight_smile:

Look at the blink without delay example in the IDE.
It performs a slow flash of a LED without calling delay().
Play around with the example, and/or have a look at Nick Gammon's blink tutorial.

Ok i will :stuck_out_tongue: Tnx again for help :wink: