2 Led´s 1 Variable

Hello, I´m new in Arduino.
I like to declare 2 Led pins in 1 Variable.
Like a = pin2, pin3.
I know how to declare 1 LED, int a = 2;.
But i want 2 LED´s.
How could I solve that problem?

Thanks for help.

Please give some addition information about your issue, what is the need for declaring two pins on one variable?

I like to create some patterns,for an LED Cube.

digitalWrite(a, HIGH);
delay(500);

I need Pin 2,3,4,5 in Variable a.
I think,that is possilbe,but i don´t know how to declare more then one pin in one variable.

Would you please try to explain what you want to do again using different words?

Is this what you mean:

int a[] = {2,3,4,5};
int index;

for (index = 0; index < 4; index++) {
   digitalWrite(a[index], HIGH);
   delay(500);
}

Hi, I think the OP wants to be able to turn on off 4 LEDs at once, and doesn't want the miniscule delay doing it one at a time consecutively.
If the LEDs are to be controlled together, there is nothing to stop you driving all 4 off the one output.
However if you want individual control, you will have to put up with sequential switching.
The only other way which is more towards machine code is to use port manipulation.

BUT because you haven't told us of your application and what you want to do with the LEDs, we await with baited breath.

Tom..... :slight_smile:

.

we await with baited breath.

sp. "bated"; it's a contraction of "abated".

Hi, you haven't smelt my breath after dinner.

Sorry didn't see.

I like to create some patterns,for an LED Cube.

Use the Search the Arduino Forum window in the top right of this page.
You will find the the cube and many LED patterns have been done before.

Tom....... :slight_smile: