Can I use Analog pi...
 
Notifications
Clear all

Can I use Analog pins as digital output pin?

1 Posts
3 Users
0 Reactions
2,757 Views
0
Topic starter

Is it possible to use analog pins as digital output? If yes, how to do this? I mean what command should I type?


1 Answer
0

Yes, on Arduino boards the analog pins can also function as digital I/O pins. Each analog pin has a digital pin number assigned internally (for example, on Arduino Uno A0 = D14, A1 = D15, and so on). To use them as digital outputs, you simply use the same commands as with normal digital pins:

 
pinMode(A0, OUTPUT);
digitalWrite(A0, HIGH);
digitalWrite(A0, LOW);

Here, A0 is used directly, but you can also refer to it by its digital pin number (like 14 for A0). This allows you to extend the number of available digital I/O pins on your Arduino.


This post was modified 6 months ago by Paul
Share: