Need programming advise for "for" keyword combined with pinMode

Hi,
Will this code work in order to set pins from 132 to 144 as output?

for (int i = 132; i <= 144; ++i)
{
pinMode(i, OUTPUT);
}

Which board has so many pins?

It's the Arduino DUE, it doesn't have that many pins I think, but if I am not mistaken those are the names of the pins 34 to 53

With pinMode and the likes the Digital I/O pins range from 0 to 53

Then I would try:

for (int i = 34; i <= 53; i++)
{
  pinMode(i, OUTPUT); 
}

Jacques

How do you get to the range from 132 to 144? You must have a source for that. Looking at the Due schematic, Arduino pin 34 is pin 59 (PC2) on the micro controller. Pin 53, Arduino pin 53 is pin 140 (PB14).

I was using this image as a guide:

but now that you mention it I think I have been writing the physical pins in the code, which isn’t going to work, so the pins I should use in the code are the digital pins?

the functions in the IDE expect you to use the light yellow "PORT PIN" number not the light blue (physical pins) ones

F1_:
the pins I should use in the code are the digital pins?

Yes indeed

Okay, so in order for this code work I need to write each pin into an Array, so for example:

int Pins[3] = {b.14, c.13, c.12}; // This is a 3 element array, thank wildbill!

for (int i; i <= 2; i++)
{
pinMode(Pins*, OUTPUT);*
}
This code above won’t work because the b.14 needs to be between some character right?
So which charactir is it?
’ " , ?

Just use 11,12,13. There is no need for any prefix. And that's a 3 element array, not 2.

Thanks, but are 11, 12 and 13 corresponding names to physical pins 53, 50 and 51?

Oh wait, I got it, sorry I struggle to understand simple things sometimes, anyways thank you for your time wildbill!

F1_:
Oh wait, I got it, sorry I struggle to understand simple things sometimes, anyways thank you for your time wildbill!

:slight_smile:

the arduino functions do the mapping for you. they know which pin number (abstracted level) map to which physical pin / port so that you don't need to worry about how those things are connected

int Pins[3] = {b.14, c.13, c.12}; // This is a 3 element array, thank wildbill!

for (int i; i <= 2; i++)
{
 pinMode(Pins[i], OUTPUT);
}

What is the value in i when the first comparison to 2 happens? Any answer other than “I haven’t a clue” is wrong.