Using Analog Pins to Produce Digital Outputs

Hello, I am using analog pin A0 (pin 14 in arduino programming) and analog pin A1 (pin 15 in arduino programming) to give digital outputs. So, I write a simple program to test this.

void setup() { // put your setup code here, to run once: pinMode(14, OUTPUT); pinMode(15, OUTPUT); }

void loop() { // put your main code here, to run repeatedly: digitalWrite(14, HIGH); digitalWrite(15, LOW); delay(5000); digitalWrite(14, LOW); digitalWrite(15, HIGH); delay(5000); }

When I used my digital meter to measure voltage of the two pins respecting to ground. That of pin 14 (A0) is high and of pin 15 (A1) is low. They didn't swap as the program said. Why does this thing happen?

Thank You BlackMelon

It is bad practice to use pin numbers for the Ax pins as you do because they are different for different Arduino boards and you don't say which one you are using.

Try using the Ax names instead of pin numbers.

There is nothing wrong with your sketch. Maybe its your wiring.

Put LEDs on A0 and A1. Use 220 ohm series resistors with the LEDs.

.