can i set more then 1 LED to HIGH in one digitalWrite?

Hello. is there any way to write this shorter?;

code:
digitalWrite(Led[0], HIGH); digitalWrite(Led[1], HIGH); digitalWrite(Led[2], HIGH);

Led[0] [1] [2] are LED ligths connected to the Arduino card.

exsample of what im thinking of;:
digitalWrite(Led[0, 1, 2], HIGH);
or
digitalWrite(Led[0][1][2], HIGH);

Use a FOR loop.

exsample of what im thinking of;

No that is the syntax for a three dimensional array, it will not work like you hope.

grumpy_mike:
Use a FOR loop.

can you give me an exsample?
thank you

HazardsMind:
No that is the syntax for a three dimensional array, it will not work like you hope.

i know that does not work, but it shows kinda how i wanted it to look.

can you give me an exsample?

for(int i=1; i<4; i++){
digitalWrite(Led[i], HIGH);
}

but it shows kinda how i wanted it to look.

tough

Check this

Doing port / registers manipulation you will "loose" sometime questionable convenience of Arduino compiler, possibly get not so kindly remarks from some resident "gurus", but gain more intimate knowledge and control of your process.
Go for it.
Cheers
Vaclav

Doing port / registers manipulation you will "loose" sometime questionable convenience of Arduino compiler

And you will also loose the convenience and simplicity and readability in your code.

possibly get not so kindly remarks from some resident "gurus",

Using direct port manipulation is great when it is needed and totally useless when it is no.

I see no need here to use it other than an attempt to confuse a beginner.

What sort of time frame is acceptable? Here's a little sketch you can use to see how long it takes to set three LEDs using both in-line and a for loop.

void setup() {
  Serial.begin(115200);
  int LED[] = { 11, 12, 13 };
  unsigned long start;
  unsigned long duration;
  start = micros();
  digitalWrite(LED[11], HIGH);
  digitalWrite(LED[12], HIGH);
  digitalWrite(LED[13], HIGH);
  duration = micros() - start;
  Serial.println(duration);  

  start = micros();
  for (int i = 0; i < 4; i++) {
    digitalWrite(LED[i], HIGH);
  }
  duration = micros() - start;
  Serial.println(duration);  

}

void loop() {
}

I get 16 microseconds on my Uno with inline and 20 microseconds with the loop. The times are only accurate to 4 microseconds.

I get 16 microseconds on my Uno with inline

One digitalWrite function takes 4uS - I measured it yesterday on an oscilloscope.

D11,12,13 are PORTB bits 3,4,5?
Then port manipulation is simple.

// write high, leave other bits unchanged
PORTB = PORTB | 0b00111000;

write low, leave other bits unchanged
PORTB = PORTB & 0b11000111;

Then port manipulation is simple.

For some one who asked could they use this:-

digitalWrite(Led[0, 1, 2], HIGH);

Then no it is not simple it is two orders of magnitude harder.