in am getting the value of analogread as 0 instead of getting some finite value.

i want to glow a led and measure the voltage flowing through the resistor. voltage is provided throgh the analog.write function.
but instead of getting the voltage value continously i am getting value as 0 sometime and some a desired value.
below is he code and i have also attached a snap of serial display.

int led = 5; // the pin that the LED is attached to
int brightness = 100; // how bright the LED is

// the setup routine runs once when you press reset:
void setup() {
// declare pin 9 to be an output:
pinMode(led, OUTPUT);
Serial.begin(2400);
}

// the loop routine runs over and over again forever:
void loop() {
// set the brightness of pin 9:
analogWrite(led, brightness);
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
delay(1000);
}

(deleted)

Right. If you measure a PWM signal you should get 5V some of the time and 0V some of the time. That’s what a PWM signal is.