Arduino I/O pins

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
oldELECTROguy
 
Posts: 34
Joined: Tue Apr 19, 2011 1:24 pm

Arduino I/O pins

Post by oldELECTROguy »

how come the ATmega328 only has 12 I/O pins when other micros have 16 I/O pins....also can the anolog pins be used as digital I/O pins....
sorry for the dumb questions new at this arduino stuff.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Arduino I/O pins

Post by adafruit_support_bill »

Actually, there are 14 digital pins. The Arduino uses pins 0 and 1 for serial communication, but you could re-purpose them if you don't need serial communication. And why not 16? It was probably an engineering decision based on fitting it into a 28 pin package.
The answer to the second question is yes. you can use analog pins as digital. When performing digital read/writes, they are addressed as pins 14-19.

oldELECTROguy
 
Posts: 34
Joined: Tue Apr 19, 2011 1:24 pm

Re: Arduino I/O pins

Post by oldELECTROguy »

hey, thanks for answering all my dumb questions

User avatar
floresta
 
Posts: 223
Joined: Thu Jul 31, 2008 10:27 am

Re: Arduino I/O pins

Post by floresta »

how come the ATmega328 only has 12 I/O pins when other micros have 16 I/O pins
The 28-pin DIP version of the ATmega328 has 23 I/O pins. Two are typically used by the crystal and a third is used for reset leaving 20 available in most applications. On the Arduino these are implemented as 14 'Digital' pins (D0 - D13), and 6 'Analog' pins (A0 - A5).

Don

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”