Declaring multiple Pins to one int?

I want to be able to make a simple light show. I have LEDs in the shape of a pyramid and I want each row to have their own phrase.

Something like this:

const int redLEDPins = (3, 7, 10);
const int yellowLEDPins = (4, 6, 8, 9);
const int greenLEDPins = (5, 7);

Heres the setup:

void setup() {
  
  pinMode(redLEDPin, OUTPUT);
  pinMode(yellowLEDPin, OUTPUT);
  pinMode(greenLEDPin, OUTPUT);
  
  digitalWrite(redLEDPin, LOW);
  digitalWrite(yellowLEDPin, LOW);
  digitalWrite(greenLEDPin, LOW);

And the loop:

void loop() {
  
  digitalWrite(yellowLEDPin, LOW);
  digitalWrite(greenLEDPin, LOW);
  digitalWrite(redLEDPin, HIGH);
  delay(150);
  digitalWrite(redLEDPin, LOW);
  delay(150);
  digitalWrite(greenLEDPin, LOW);
  digitalWrite(redLEDPin, LOW);
  digitalWrite(yellowLEDPin, HIGH);
  delay(150);
  digitalWrite(yellowLEDPin, LOW);
  delay(150);
  digitalWrite(redLEDPin, LOW);
  digitalWrite(yellowLEDPin, LOW);
  digitalWrite(greenLEDPin, HIGH);
  delay(150);
  digitalWrite(greenLEDPin, LOW);
  delay(150);
  
}

I will post a picture of the circuit as soon as I can.

I will post a picture of the circuit as soon as I can.

Good.

Will you also post the question at the same time or do we have to make that one up?

Grumpy_Mike:

I will post a picture of the circuit as soon as I can.

Good.

Will you also post the question at the same time or do we have to make that one up?

facepalma my bad.

I wanted to know if I can use one phrase to control multiple outputs at once.

I wanted to know if I can use one phrase to control multiple outputs at once.

No. You can use an array of pin numbers and a for loop to operate on each of the elements in the array, but there are no magic shortcuts.

PaulS:

I wanted to know if I can use one phrase to control multiple outputs at once.

No. You can use an array of pin numbers and a for loop to operate on each of the elements in the array, but there are no magic shortcuts.

So I can't do something like this?

const int redLEDPins = 3, 7, 10;

Wow. I could've sworn seeing people do that.

I wanted to know if I can use one phrase to control multiple outputs at once

If you mean by "one phrase" one statement then no.

However if you use direct port addressing you can use one statement to control up to 8 outputs at a time. However, this is non portable across arduinos and takes a bit more thinking about.

But you are better off doing what PaulS says.

Unfortunately,
X = 1,2,3; is perfectly valid syntax.

But it does not do what you want. google comma operator.