What pins are called when and how.

Folks,

I HAVE googled this but the results are not what I was curious about.

There are PWM pins, Digital Out pins, Analogue in pins, etc.

Usually the native LED is on "Pin 13" - I read.

Where is "pin 13" defined?

It is an output, but which one?

Is there a "table" which shows these pin NUMBERS to what they are called on the Arduino?

It's in one of the .h files. This graphic may help:

The "Arduino" pin numbers are in brackets, with the chip pin numbers nearby.

Hi lost_and_confused,

Assuming you have a UNO then look at http://arduino.cc/en/Hacking/PinMapping168 to see how the pins are mapped between the Arduino IDE/ UNO board and the ATMega328 chip. If you look at the UNO from above (see below image) then you can see the defined digital pins 0-13 and the analogue pins A0-A5. Any digital pin number with a ~ character in front of it is capable of PWM (Pulse Width Modulation). See http://arduino.cc/en/Tutorial/PWM for PWM tutorial.

Hope this helps.

Thanks both.

Ok, I'll try another way.

(No offence)

And no I haven't looked at the links yet because what I am reading doesn't answer what I meant to ask.
My fault.

Be it the "Ardunio's name" for the pin, like Analog in, or the actual CHIP's pin number; I am still confused when I read a Sketch.

Example: (note that word - posting the code is silly)
Digital.write(16,high)
Or:
Digital.write(buzzer,high) with buzzer being defined as "17" earlier.

But what is 17?
Is that the IC's pin number or the Arduino's designation?

Is that any clearer to what I am meaning and where I am confused?

It is the Arduino's designation. i.e. the numbers printed on the board in the picture above.

Thanks Wildbill.

Appreciated.

But not wanting to seems a doubter, what you said raises a problem:

(Yes, back to that "multiday alarm clock" code.)

I bought a Phi-2 shield which plugs into the Arduino board.

I am realising as good as the shield is, it has problems as well. But anyway.
See my post about asking for help on the Phi-2 shield.
http://arduino.cc/forum/index.php/topic,107642.0.html

I am using a "Freetronics" board which is basically a basic board with no ethernet. USB port only. (Well, and power)

The shield plugs into the board as does most any other shield.

On the picture of the link, I have ALARM designated. That is called BUZZER in the sketch.
Early on in the sketch that is assigned to "16".

But looking at the picture of the UNO's board, and all over mine, there is no "pin 16" to be found.
What that becomes on the Arduino is the A2 pin.

So I am still confoused how it all works.

Pin 14 is using A0 as a digital instead of an analogue.
Pin 15 is using A1 " " " " " " "
Pin 16 " " A2 etc..
etc...

http://arduino.cc/playground/Main/ShieldPinUsage

Pluggy,

Thanks.

That makes sense, but the next question is where is this "declared"?

In the sketch usually.

This is a line out of one of my sketches :

#define gasdigiPin A0

Writing it like this would be exactly the same :

#define gasdigiPin 14

then whereever "gasdigiPin" is used in the sketch it means the physical pin A0 (or 14).

Pluggy:

In the sketch usually.

This is a line out of one of my sketches :

Code:
#define gasdigiPin A0

Writing it like this would be exactly the same :

Code:
#define gasdigiPin 14

then whereever "gasdigiPin" is used in the sketch it means the physical pin A0 (or 14).

Ok, with what you have explained about A0 being "14" and A1 being "15" (etc) that makse sense.

But I am a "noob" and as much as I accept I have to learn things I can't find where this association between A0 and "14" is..... documented.

I have modified the sketch (multi day alarm clock v5) from using 16 to 17 for the alarm signal.
The only reason I did it was to keep things neat on the PHI-2 shield. The two straps and the signal are now together and the "header" I made is a bit neater.
Well, maybe not. But I like to keep things together.
I was pulling my hair out trying to derive what this "16" was. As the pin beside it was not used I changed it to 17 and hoped.

Complied, and lucky me, it is/was that pin. As I still don't know what the other headers are doing and where they go on the shield, I am at a slight impass to go further because I may be making problems for myself in the future.

I dunno, at some point in the dim and distance past somebody decided that pin A0 would be also called pin 14, its documented here : Arduino Playground - Shield Pin Usage
Thats just the way it is, I accept it because it works.

A bit more on the official (not wiki) part of the Arduino site : http://arduino.cc/en/Tutorial/AnalogInputPins

Argh!

"Shield pin usage".

Silly me.

I was looking for "Arduino pin designation".

Thanks.

That will clearer.

I guess they just continued on from the "digital pins".

lost_and_confused:
That makes sense, but the next question is where is this "declared"?

In pins_arduino.h:

const static uint8_t A0 = 14;
const static uint8_t A1 = 15;
const static uint8_t A2 = 16;
const static uint8_t A3 = 17;
const static uint8_t A4 = 18;
const static uint8_t A5 = 19;
const static uint8_t A6 = 20;
const static uint8_t A7 = 21;

Nick,

Thanks to you too.

All these files!

(Tangent:
Reply #13 on: Today at 09:37:36 AM
09:37 today?
Wow, it is only 07:41 here. (Sydney)
How does that work?
/TANGENT)

Ok. I have learned something today, so it isn't a total waste.

:slight_smile:

Now I've got to get back to work and when I get home, do some more work on the "interface" between the Arduino and the other electronics.

Fun fun fun.

You need to set your time zone information in your profile.

I see my post as being at 7:37 am, your time zone is probably wrong.