2 LED BLINK WITH DIFFERENT TIME

HERE I SUMBIT MY CODE, ANYONE HELP ME TO COMPLETE THIS.

void setup() {
// put your setup code here, to run once:
pinMode(13, OUTPUT);
pinMode(11, OUTPUT);

}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(13, HIGH);
delay(6000);

digitalWrite(13, LOW);
delay(1000);
}

void loop2() {
digitalWrite(11, HIGH);
delay(100);
digitalWrite(11, LOW);
delay(100);
}

Read this thread. (Perhaps not all of it, though that would be a good tutorial. :grinning: )


Next, please go and read the instructions, then go back and modify your post using the "More --> Modify" option to the bottom right of the post, to mark up the code (but it always needs to be the complete code) as such so we can examine it conveniently and accurately. Please do not post a ".ino" file as an attachment - that would mean that you are expecting people to actually load it to their IDE to look at it and that is extra unnecessary labour. In fact, attachments do not always show properly on different operating systems.

If you do not mark it up as code, the code you post could well be garbled and is frequently anything but easy to read.

Note: Also mark up any data in the same way. This includes error output that you get from the IDE.

And - before you post any code, use "Auto Format" in the Tools menu of the IDE to properly present the code.

Try and avoid unnecessary white space (blank lines). You should only use these to separate functional blocks of code.

You cannot run two loops on a Arduino Mega processor, you need a processor with a operating system or multiple kernels. One possibility is the ESP32, but it requires some process configuration to work.

There are other ways to do multiple jobs on the Mega processor.

As Paul__B says all the techniques you need to use are explained in SeveralThingsAtTheSameTime

And by a bit of luck one of things the demonstration program does is blink several LEDs with different timings.

Steve

Or you could look at:-
http://www.thebox.myzen.co.uk/Tutorial/State_Machine.html