Digital Write to an Analog Input

When writing to a digital io pin, the syntax is digitalWrite(pin, state) where pin is an integer and state is "HIGH" or "LOW". So if I''m using an analog pin as a digital output, whats the syntax?

digitalWrite("A0", HIGH); causes the compiler to generate a syntax error.

Try just calling it 14…

It's just A0, not "A0":

digitalWrite(A0, HIGH);

Nick_Pyner: Try just calling it 14.......

Better to use A0 to make the code more portable.

UKHeliBob: make the code more portable.

Ah yes. I only ever use one analogue pin but I now see the opportunity to sweep out some programmes for the Megas....

That worked fine, thanks!

How does digitalWrite convert e.g. A5 to an unsigned int behind the scenes? I looked at wiring_digital but I can't see where this happens. Are A0 to A5 #defines which reference pin numbers?

How does digitalWrite convert e.g. A5 to an unsigned int behind the scenes?

It doesn't - the A0... aliases are defined in "pins_arduino.h" (and they're "uint8_t"s, not unsigned ints)