all int?

Hi - I have multiple LED's set up for turning on and off and stuff.

is it possible to create separate ints for them (EG: int blue; int red; int green;) but then also to have an int for all of them to save space and time? EG: int all; ?

I attempted by writing

int all;

void setup()

all = 5;
all = 6;
all = 7;

but then all that happened was 5 lit up.

Thanks!

is it possible to create separate ints for them

Yes.

but then also to have an int for all of them to save space and time? EG: int all;

No.

You could put the pin numbers in an array, and loop through the array to turn them all on or off.

that would work, I didn't think of that - thanks

While you can't have an int that sets them all, you can use a function that sets the other ints.

So instead of:

int all;

void setup()
{
all = 5;
}

You would have something like:

int red = 0;
int green = 0;
int blue = 0;

void setup()
{
SetAll(5);
}

void SetAll(int value)
{
red = value;
green = value;
blue = value;
}

Note that this will only work for global variables, but that is fine if you are following Arduino standards.