When passing the pin number in pinMode its possible to use A0 - A7, does it apply only to that methode? How can pinMode expect a number (is it int?) type in case of digital pin another (is it then string?) in case of analog pin? I want to use that in my class methode, is there a way to use that and have my code more readable or should I use the pin numbers? P.S. I have tried to read the source code but I don't understand the uin8_t (I know its a byte, but not how it can understand A5 as an int)

Tnx a lot


pinMode is actually declared as void pinMode(uint8_t, uint8_t); in arduino.h

A0 is a defined as a number (somewhere depending on the actual hardware), on an Uno/Nano it translates to 14, and when executing pinMode it translates to the appopriate bit in the correct DDRx register.

  • On an atmega328 Arduino pin 14 ( or A0 ) is directed to PORTA bit 0, which can be used as a digital I/O or alternatively as an ADC channel. Nov 24 '19 at 13:31
  • The ATmega328 doesn't have a port 0. pin 14 (A0) is PC0. Nov 24 '19 at 19:05
  • Correct: PORTC Bit 0 Thanks. In the DIP28 atmega328P-PU its Pin 23 Nov 24 '19 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.