Using Arduino Mega ANALOG INPUT PINS as digital

Dear Team,

May I know can I use the 16 ANALOG INPUT PINS of Arduino Mega as digital.
My intention is to use these pins for turning on and off a transistor that is controlling a relay.

Regards
HARI

Of course you can.

You can write with below both.
And get the same result.

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

1 Like

Hi chris,

Thank you.

Regards
HARI

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.