LEDs control help

Hello,

I have 4 LEDs and my project is that I want 2 Red LEDs to flash constantly for 10 times then the other 2 Green LEDs to flash for 5 times only. I tried using the for loop but it doesn't seem to give me the solution. What should I do?

void setup()
{
pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
}

void loop()
{
int x;

for(x = 1; x < 10; x++)
{
digitalWrite(1, HIGH);
digitalWrite(2, HIGH);
}
delay (100);

for(x = 1; x < 10; x++)
{
digitalWrite(1, LOW);
digitalWrite(2, LOW);
}
delay (100);


for(x = 1; x < 5; x++)
{
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
}
delay (100);

for(x = 1; x < 5; x++)
{
digitalWrite(3, LOW);
digitalWrite(4, LOW);
}
delay (100);
}
}

I tried using the for loop but it doesn't seem to give me the solution.

What does happen? When asking for help it is useful to post "what you expect to happen" and "what does happen."

Hint. The way you have created your code, the for() loops are pointless. You do the same thing 10 (or 5) times in a row and then pause. If you removed the for() loops, you would probably get the same results.

I would start by getting one LED to flash and work up from there.

Notes:
in this code, your loop does nothing but set the same pin high 10 times.

for(x = 1; x < 10; x++)
{
digitalWrite(1, HIGH);
digitalWrite(2, HIGH);
}
delay (100);

Untested code ... notice it goes high - delays - then low and delays .. this is how you "flash" leds.

for(x = 0; x < 10; x++)
{
digitalWrite(1, HIGH);
digitalWrite(2, HIGH);
delay (500);
digitalWrite(1, LOW);
digitalWrite(2, LOW);
delay (500);
}

Also - if you want 10 .. change x to zero or < to <11 or <=10, notice the code above is changed to start at 0.