pinMode vs' physical pin and integer value

From this description of "int":
"Syntax
int var = val;
-var - your int variable name
-val - the value you assign to that variable"

I understand that writing

 const int pin11 = 11;

pin11 is a variable and its name, 11 is its value.
Just as in int a = 250;
a is the variable and its value is 250.

If i write

const int pin11 = 11;
int a = 250;

void setup(){
  pinMode(pin11, OUTPUT);
  pinMode(a, OUTPUT);
}

void loop(){
  digitalWrite(pin11, HIGH);
  digitalWrite(a, HIGH);
}

I know the physical pin 11 on my Arduino UNO will be digital high at 5 volts.
I would assume the code will try to program 'imaginary pin' 250 to turn digitally high also.
But, are the #'s 1-13 and A0-A5 just automatically routed as the physical outputs do to the compiler
when using the pinMode function?
I would much rather prefer using another name for the physical outputs than just a number, which seems confusing.
I want to understand better whats going on with the "pinMode" function.

Here is my beginner knowledge at work trying to make use of my blue board to auto cycle through as an 8 channel switch>
(it compiles fine and is presumed to work)

/* This program will be used to create an on/off 
scan of the outputs for an arpeggiator of 8 notes.
The output pins will control the base of a mosfet as a switch
for audio or control a switching ic. It may even be used to
switch between eight variable resistors using BJT transistors
as the switch to ground for a smaller voltage controlled arpeggiated synth. */


// define Atmega328 pins to be used as a constant,nonchangable value.
// Initialize's pins 5-12 on the chip to be used and names them (pin5,pin6,pin7...)
const int pin5 = 5; 
const int pin6 = 6;
const int pin7 = 7;
const int pin8 = 8;
const int pin9 = 9;
const int pin10 = 10;
const int pin11 = 11;
const int pin12 = 12;
// Initalizes 'a' as a value to be easily changed in the future.
// Future code: Write 'a' value to a potentiometer value being read,
// Or even read a digital on or off for in tempo scanning 
int a = 250; // a = 250 milliseconds when used in the 'delay' function.

// Setup routine runs once the reset button is pushed or when power is applied.
void setup()
{ 
  //make each of the pins an output.
  pinMode(pin5, OUTPUT);
  pinMode(pin6, OUTPUT);
  pinMode(pin7, OUTPUT);
  pinMode(pin8, OUTPUT);
  pinMode(pin9, OUTPUT);
  pinMode(pin10, OUTPUT);
  pinMode(pin11, OUTPUT);
  pinMode(pin12, OUTPUT);
}


// loop function loops the program forever.
void loop()
{
  digitalWrite(pin5, HIGH); //turns the first note on/pin5 high
  delay(a);               //wait for .25 seconds/plays note for 250 milliseconds
  digitalWrite(pin5, LOW);  //turns pin 5 off/digital low/zero volts
  digitalWrite(pin6, HIGH); 
  delay(a);
  digitalWrite(pin6, LOW);
  digitalWrite(pin7, HIGH);
  delay(a);
  digitalWrite(pin7, LOW);
  digitalWrite(pin8, HIGH);
  delay(a);
  digitalWrite(pin8, LOW);
  digitalWrite(pin9, HIGH);
  delay(a);
  digitalWrite(pin9, LOW);
  digitalWrite(pin10, HIGH);
  delay(a);
  digitalWrite(pin10, LOW);
  digitalWrite(pin11, HIGH);
  delay(a);
  digitalWrite(pin11, LOW);
  digitalWrite(pin12, HIGH);
  delay(a);
  digitalWrite(pin12, LOW);
}

Google poet manipulation. What you ate actually doing is setting or clearing a bit in a register. pinMode creates an attraction layer for the various chips.

vertamps:
I know the physical pin 11 on my Arduino UNO will be digital high at 5 volts.
I would assume the code will try to program 'imaginary pin' 250 to turn digitally high also.
But, are the #'s 1-13 and A0-A5 just automatically routed as the physical outputs do to the compiler
when using the pinMode function?
I would much rather prefer using another name for the physical outputs than just a number, which seems confusing.
I want to understand better whats going on with the "pinMode" function.

you ARE using another name... pin11 in your example is completely arbitrary.

you write this:

const int pin11 = 11;
pinmode(pin11, OUTPUT);

compiler sets aside an int for the value of pin11 and it sees this:

pinMode(11, OUTPUT);

look at it this way:

const int doo = 5; 
const int ray = 6;
const int mee = 7;
const int faa = 8;
const int soo = 9;
const int laa = 10;
const int tee = 11;
const int doo2 = 12;
// Initalizes 'a' as a value to be easily changed in the future.
// Future code: Write 'a' value to a potentiometer value being read,
// Or even read a digital on or off for in tempo scanning 
int a = 250; // a = 250 milliseconds when used in the 'delay' function.

// Setup routine runs once the reset button is pushed or when power is applied.
void setup()
{ 
  //make each of the pins an output.
  pinMode(doo, OUTPUT);
  pinMode(ray, OUTPUT);
  pinMode(mee, OUTPUT);
  pinMode(faa, OUTPUT);
  pinMode(soo, OUTPUT);
  pinMode(laa, OUTPUT);
  pinMode(tee, OUTPUT);
  pinMode(doo2, OUTPUT);
}


// loop function loops the program forever.
void loop()
{
  digitalWrite(doo, HIGH); //turns the first note on/pin5 high
  delay(a);               //wait for .25 seconds/plays note for 250 milliseconds
  digitalWrite(doo, LOW);  //turns pin 5 off/digital low/zero volts
  digitalWrite(ray, HIGH); 
  delay(a);
  digitalWrite(ray, LOW);
  digitalWrite(mee, HIGH);
  delay(a);
  digitalWrite(mee, LOW);
  digitalWrite(faa, HIGH);
  delay(a);
  digitalWrite(faa, LOW);
  digitalWrite(soo, HIGH);
  delay(a);
  digitalWrite(soo, LOW);
  digitalWrite(laa, HIGH);
  delay(a);
  digitalWrite(laa, LOW);
  digitalWrite(tee, HIGH);
  delay(a);
  digitalWrite(tee, LOW);
  digitalWrite(doo2, HIGH);
  delay(a);
  digitalWrite(doo2, LOW);
}

To be clear the pin # argument to pinMode() and digitalWrite() is NOT a physical pin number on the chip.
It is an Arduino digital pin # which is used to index into a set of tables that maps the Arduino digital pin # to an
I/O port register and bit within that port register.
The pinMode() and digitalWrite() functions call other routines to do the lookup.

So for example, Arduino digital pin #2 is mapped to I/O port register D, bit 2 which is physical pin 4
on the 28 pin Atmega328 part.

The pinMode() and digitalWrite() routines do not sanity check that the Arduino pin number
you pass in is valid and neither do the functions they call to do the actual lookup.
When you pass in invalid values like 250, the code will blindly use that number to index
into the table (which is in flash) and will index off the end of the table for its mapping data.
The data fetch is a bit unpredictable,
so for all practical purposes, you will be setting bits in garbage/random i/o registers or possibly even
memory.

--- bill

Arrch' shot me in the right direction to understanding what "pinMode();" is doing.

What did not sit well with me is that 'pinMode was automatically taking my random number from my
variable and assigning it to a port without me understanding why or how it came to the conclusion to use my number as the address to a port. I am sure this info about Port Manipulation would have come up
further in my books and tutorials but i was restless on this issue as a beginner, i am glad i posted.
I am also glad my father had explained to me how to read and write in binary so my brains not hurting on that one while reading about the ATmega328 ports.

I understand writing the blink program with : "int led = 13 " is a good intro for a programming baby like myself, but it was not concrete enough for me.

These explanations and directions are something that probably should be noted in the beginner atmosphere to further explain whats going on (they might be on the horizon of my readings i just don't know it yet), but at least
i got them now. Thank you~

Arrch:
Google poet manipulation. What you ate actually doing is setting or clearing a bit in a register. pinMode creates an attraction layer for the various chips.

How is poet manipulation going to help?

feels good if you are a poet

BulldogLowell:
feels good if you are a poet

Depends on what's being manipulated, I guess.