LED FLASHING CODE

Hi,

I am new to this and have two code that I would like to merge without changing the the effect one has on the other. So far any changes I make chge the flashing rate of the other. Not sure if what I am trying to do is possible

Code1

void setup(){
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
}

void loop(){
digitalWrite(13, HIGH);
digitalWrite(12, LOW);
delay(500);
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
delay(500);
}

Code2

int pinArray[] = {2, 3, 4, 5, 6, 7};
int count = 6;
int timer = 15;

void setup() {
// we make all the declarations at once
for (count = 0; count < 6; count++) {
pinMode(pinArray[count], OUTPUT);
}
}

void loop() {
for (count = 0; count < 6; count++) {
digitalWrite(pinArray[count], HIGH);
delay(timer);
digitalWrite(pinArray[count], LOW);
delay(timer);
}
}

Look at Examples ---> 02. Digital ---> BlinkWithoutDelay

Unless you understand that sketch, you will not be able to achieve your desire to have two LEDs blink at different rates.

ieee488:
Look at Examples ---> 02. Digital ---> BlinkWithoutDelay

I found this Youtube video very useful for understanding BlinkWithOutDelay, with 2x LEDs.

The trick is never to use the delay function.