can i have two loops run at the same time??? HELP ME FAAASST!!!!!!!!!!

hi people!
arduinofreaklol here!

i made a project that has a series of flowing LEDs and a button that lights up two other LEDs.
the problem is, that the LEDs controlled by the button only activate after the flowing LEDs start over on their flow!

here is the code:

const int keypin = 11;
void setup() {
pinMode(2, OUTPUT);
pinMode(13, OUTPUT);
pinMode(keypin, INPUT);
}

void loop() {
if(digitalRead(keypin) == HIGH) {
pinMode(10, OUTPUT);
digitalWrite(10, HIGH);
delay(40);
digitalWrite(10, LOW);
delay(40);
pinMode(12, OUTPUT);
digitalWrite(12, HIGH);
delay(40);
digitalWrite(12, LOW);
delay(40);
}
pinMode(2, OUTPUT);
digitalWrite(2, HIGH);
delay(40);
digitalWrite(2, LOW);
delay(40);
pinMode(3, OUTPUT);
digitalWrite(3, HIGH);
delay(40);
digitalWrite(3, LOW);
delay(40);
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
delay(40);
digitalWrite(4, LOW);
delay(40);
pinMode(5, OUTPUT);
digitalWrite(5, HIGH);
delay(40);
digitalWrite(5, LOW);
delay(40);
pinMode(6, OUTPUT);
digitalWrite(6, HIGH);
delay(40);
digitalWrite(6, LOW);
delay(40);
pinMode(7, OUTPUT);
digitalWrite(7, HIGH);
delay(40);
digitalWrite(7, LOW);
delay(40);
pinMode(14, OUTPUT);
digitalWrite(14, HIGH);
delay(40);
digitalWrite(14, LOW);
delay(40);
pinMode(15, OUTPUT);
digitalWrite(15, HIGH);
delay(40);
digitalWrite(15, LOW);
delay(40);
pinMode(16, OUTPUT);
digitalWrite(16, HIGH);
delay(40);
digitalWrite(16, LOW);
delay(40);
pinMode(17, OUTPUT);
digitalWrite(17, HIGH);
delay(40);
digitalWrite(17, LOW);
delay(40);
pinMode(18, OUTPUT);
digitalWrite(18, HIGH);
delay(40);
digitalWrite(18, LOW);
delay(40);
pinMode(19, OUTPUT);
digitalWrite(19, HIGH);
delay(40);
digitalWrite(19, LOW);
delay(40);
}

hope you understand my problem and are able to help me!!!

I NEED THIS FIXED ASAP!!!!!!!!!!!!!!!!!!!!!!!!

Hello,

Look at the Blink Without Delay example.

Look at the Blink Without Delay example to learn how to handle the timing of your leds without putting the Arduino into a coma with the delay function so you can keep reading your button while they do their thing.

arduinofreaklol:
I NEED THIS FIXED ASAP!!!!!!!!!!!!!!!!!!!!!!!!

When is your homework due?

Please read the two posts at the top of this Forum by Nick Gammon on guidelines for posting here, especially the use of code tags which make the code look

Have you seen the above request before?

The demo Several Things at a Time illustrates the use of millis() to manage timing and how to make several ....

...R