READING CODE SIMULTANEOUSLY?

Hi
I am a beginner in this subjekt :smiley:
Is it possible to run two parts of the code at the same time?
ex.
void setup()
{
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
void loop ()
{
digitalWrite(12, HIGH);
delay(2000);
digitalWrite(12, LOW);
delay(2000);
}

I know that I cant use void loop twice, but is it possible in some other way?
I hope you understand me :stuck_out_tongue:

grateful for answers

If you want two LEDs to turn on at the same time, and off at the same time, do that.

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

thank you for reply

but if I want one of the LED blink with 1 sec and the other with 2 sec but start at the same time. Is it possible?

http://www.arduino.cc/playground/Code/TimedAction

Take a look at the 'The examples at once' which 'reads' three arduino examples at once.

thanks!
Thats what Im looking for.
But I have one question, when I copy the code and when I veryfi it it says "TimedAction does not name a type" and the row that is highlighted is

TimedAction blinkAction = TimedAction(1000,blink);

what is the problem?

Did you download the library? Refer to the download section.

Did you #include <TimedAction.h> ?

oh...sorry, missed it
starting to get late, my bad

No worries :slight_smile:

Good luck!