Send a high to severals pins.

I want to light on 8 leds conected to differents pins and a can do it , but using 8 digitalWrite() sentence. My question is how can i use just one , i tried doing this "digitalWrite( D2,D3,D4 , HIGH);" -- and it didn't work so i tried like this "digitelWrite( D2& D3& D4& , HIGH);"-- but didn't work either. I hope you can help , thanks. Saludos desde Argentina.

What is wrong with 8 commands to do it?

Can ports be used for this? I have never used them.

I’ve never used [u]port commands[/u] either, but if your hardware isn’t finalized yet you can connect the LEDs to the pins that constitute a port.

Or if the pin numbers are sequential, you can make a loop and increment the pin number each time through the loop.

Using 8 x digitalWrite() is the normal way. You can shorten the code by putting the pin numbers and the values to be written into two arrays and then doing something like this

for (byte n = 0; n <8; n++) {
  digitalWrite(ledPins[n], ledValues[n]);
}

…R
PS. One could use port manipulation for this, But I suspect it is not necessary in this case and it makes the code more complicated for a beginner.

Port commands are fine. Examples: PORTD = PORTD | 0b00111100; // set D5,4,3,2 high, leave rest along PORTB = PORTB | 0b00001111; // set D11,10,9,8 high

PORTD = PORTD & 0b11001111; // clear D5, D4, leave rest alone

My question is how can i use just one

My question is" Why is this important?" (Actually, my question is " Why do you think this is important?")