Timing of progam  loops -

I am new to Arduino and have cut and pasted and modified the led program. i am curious aobut how timing ofthe program works.

with this program the leds blink alternately, What is the default time delay between camands?

And - how do i get two lights to blink at the thesame time – go on andoff at the same time.

anyone who couldhelp me find documents - or help with understanding the timing of the arduino program - i would appreciate it -

thanks Daley :slight_smile:

int redPin = 12; // Red LED connected to digital pin 12
int greenPin = 11; // Green LED connected to digital pin 11
int bluePin = 10;
int orangePin = 9;
void setup() // run once, when the sketch starts
{
pinMode(redPin, OUTPUT); // sets the digital pin as output
pinMode(greenPin, OUTPUT); // sets the digital pin as output
pinMode(bluePin, OUTPUT);
pinMode(orangePin, OUTPUT);
}

void loop() // run over and over again
{

digitalWrite(bluePin, HIGH);
delay(355);
digitalWrite(bluePin, LOW);
delay(355);

digitalWrite(redPin, HIGH ); // sets the Red LED on
delay(350);

digitalWrite(redPin, LOW);
delay(350); }

What is the default time delay between camands

very fast

 digitalWrite(bluePin, HIGH);
digitalWrite(greenPin, HIGH);
delay(355);
digitalWrite(bluePin, LOW);
digitalWrite(greenPin,LOW);

What is the default time delay between commands?

There is no extra delay imposed between commands to make them all run at the same speed; everything is run as quickly as the processor can handle. A call to digitalWrite takes roughly 4 microseconds. Simple computations are much faster.