Can you use Analog Write as a simple 5v output?

I have just installed my Ardunio Uno on my Model Railroad. There are 5 different projects all running at the same time and using Millis for delay times and running on the same script. It works perfectly. I have only used the Digital outputs. My question is this.

  1. Can I now use the Analog as outputs to create more project?

  2. Using the same Millis Code as with the Digital will I be able to just add them to the one script as they all must run at the same time?


If you mean A0 to A5, yes, you can use them as digital outputs.

Your question doesn't really make sense.

I suspect that you are thinking that analogWrite() is for use with the pins marked "An" (e.g., A0, A1) on your Arduino board. This is not correct. analogWrite() can only be used with the pins on the board that have PWM (or DAC on certain Arduino boards), as documented on this page:

If you want to use the pins marked An as regular digital outputs, just use then with digitalWrite() or digitalRead(). For example:

digitalWrite(A1, HIGH);

OK Got it. Now ,how about the second part. Can I use the same Millis code that I am using and just replace the Digital output number slot with A1.


If your millis() code will work with a digital-only pin, it will also work with a pin that also has ADC capabilities (pins marked An).

Are you talking about A0-A5? Sorry for the simple question but I am a beginner.

Stay Safe

Yes, that's correct. Sorry if that notation was not very clear. The n was meant to represent an arbitrary number.

Thanks again and Stay Safe

This is not a scold. It's advice. All the answers to your questions so far, are on the first page of the Arduino documentation. Please always look there first, it will save you a lot of time.

The analog input pins can be used as digital pins

A0 to A5 can also be addressed as D14 to D19.

A0 to A5 can also be addressed as 14 to 19 when they are used as "Digital IO Pins"

A0 to A5 can also be addressed as 14 to 19 when they are used as “Digital IO Pins”

…on 168 and 328-based devices.