Problem using analog pins as digital to use eg, a lm35 directly in uno board

I would like to place a LM35 directly in Uno Board

The following code makes it possible: to use "VCC" on pin 15, to read analog value from pin 16. but for some reason it is not possible to get zero volt on pin 17.

is there some one out there, knowing what i do wrong

int potPin = 2; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int VCC = 15;
int GND = 17;
int val = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600); // ...set up the serial ouput on 0004 style
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
}
void loop() {
val = analogRead(potPin); // read the value from the sensor
Serial.println(val);
digitalWrite(VCC, HIGH); 
digitalWrite(GND, LOW); 
digitalWrite(ledPin, HIGH); // turn the ledPin on
delay(val); // stop the program for some time
digitalWrite(ledPin, LOW); // turn the ledPin off
delay(val); // stop the program for some time

First off your wiring is wrong! The devices VCC pin goes to the socket barked 5V, the devices gnd goes to the socket marked as GND. And the third to AO.

Then your code just reads A0.

Do not try to provide power or ground from the digital pins.

Mark

If the power draw is less than 30 mA you can use digital pins for power. I’ve used this trick for the HC-SR04 ultrasonic distance sensor.

Your main problem is that you forgot to set A1 and A3 to pinMode OUTPUT.

You should also use the names (A0-A5) instead of numbers when using analog input pins for digital pins. The mappings of numbers to analog pins changes for different Arduino models. The numbers you used will work on the UNO but not the MEGA or Leonardo.

int potPin = A2; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int VCC = A1;
int GND = A3;
int val = 0; // variable to store the value coming from the sensor

void setup() {
    Serial.begin(9600); // ...set up the serial ouput on 0004 style
    pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
    pinMode(A1, OUTPUT);
    pinMode(A3, OUTPUT);
}