---
title: "Arduino pinMode on Analog Inputs"
description: "Quick tip on when you use pinMode with analog inputs on an Arduino board."
canonical: "https://www.baldengineer.com/arduino-pinmode-on-analog-inputs.html"
author: "James Lewis"
date: "2015-04-20T14:00:50Z"
lastmod: "2022-04-04T20:46:46Z"
categories: ["arduino"]
tags: []
---

# Arduino pinMode on Analog Inputs


[![pinMode analog input tip](/wp-content/uploads/2015/04/pinMode-analog-tip-banner-trans.png)](/wp-content/uploads/2015/04/pinMode-analog-tip-banner-trans.png)

All Arduino boards contain analog and digital pins. The Arduino functions have different calls depending on the pin type. For example, when calling analogRead(), an analog input pin is automatically changed from a digital input (or output) into an analog input. For this reason, it isn't [necessary to call the pinMode](/when-to-use-arduinos-pinmode-and-why.html "When to use Arduino's pinMode() (and why)") function on the pin. However, when I write Arduino Sketches, I still put a pinMode(A0, INPUT) in setup anyway.

Keep reading to see [why I use pinMode on Analog Inputs](/arduino-pinmode-on-analog-inputs.html).

## Why use pinMode on Analog Inputs?

Because when I look at the code, especially after a long break, I want to know what pins I am using _and how_. So if I look at setup() and see I am pinMode() on the pins, I'll know I'm using it. Additionally using the designator A0 instead of 14, on an Uno, I know I mean the Analog pin.

However, there is still a problem.

How do I know whether or I am using the pin as a digital or analog input?  Even though I call it A0, maybe I want the pin to be digital.

Well, in that case, I use a comment.

```c

// Example of how I setup analog inputs
void setup() {
     pinMode(A0, INPUT); // analog
}

void loop() {
     int reading = analogRead(A0);
}

```

// EOF

Simple, but effective.

