xxxPin means its a pin?

if I would type:
int ledPin =10;
pinMode(ledPin,OUTPUT);

would that be thesame as typing:
int led =10;
pinMode(led,OUTPUT);

Or does the little attached word “Pin” actually define that it is about a pin?

The naming is for your benefit. it makes no different as long as the naming matches the intended usage. A big program might create a lot of ambiguity about the meaning of LED. ledPin helps to keep it from getting in the way of other LED name usage.

It is your own program, you have great freedom with regards to variable naming.

pwillard is correct. It doesn’t matter what you name your variable.

You could even have:
int mydoodad =10;
pinMode(mydoodadd,OUTPUT);

and it would be the same as the two examples you gave.

So the word pinMode actually defines it’s about a pin right?

“pinMode” is a function.
Its parameters define a pin number and a mode.
The function is called with these parameters.
Thus “pinMode (13, OUTPUT);” sets pin thirteen to be an output.

If we’d said:
const int ledPin = 13;


pinMode (ledPin, OUTPUT);

we’d have achieved the same result.

If we’d said:
const int ledPin = 13;


pinMode (ledPIN, OUTPUT);

we’d have achieved the same result.

Except for the capitalisation issue. :slight_smile:

–Phil.

:-[

So the word pinMode actually defines it's about a pin right?

pinMode sets the mode on the pin of whatever number you give it. But you can use that variable for other things besides pinMode. eg

int CurrentYear;
int YearBorn;
int age;

CurrentYear = 2009;
YearBorn = 1999;
age = CurrentYear - YearBorn; //That’s 10 years old :slight_smile:

pinMode(age,OUTPUT);
digitalWrite(age, HIGH); //turn on pin corresponding to age
//better hope the kid’s 13 or less

You’re making it a lot more complex than needed. int ledPin = 10; means ledPin is an integer storing the number 10.

pinMode and other functions want to see an integer of which pin to act on. There is nothing special about ledPin before and after pinMode is called.