How to measure led volts whit analogread()

Hi all
I want to measuer the volts in an led lamp, this lamp is increasing in time the voltage whit PWM (analogwrite())
The mesure taken is not the correct one and always whiout decimal values.
its possible? any suggestion, or brillant idea?

code
sensorValue = analogRead(sensorPin);
sensorValue = map(sensorValue, 0, 1023, 0, 2.9);
Serial.print(sensorValue);

int sensorValue = analogRead(sensorPin);
float sensorVoltage = map(sensorValue, 0, 1023, 0, 2.9);  // Convert to Voltage (assuming analog reference is set to 2.9v)
Serial.print(sensorVoltage);

You didn't show all your code so I'm guessing your mistake is declaring sensorValue as 'int' and then trying to store a 'float' in it.

analogRead() returns an int. map() takes and returns longs. You can't get floating point numbers from what you are trying to do.

Thanks
but thats not the issue

const int PinBlueLed=9;
const int PinWhiteLed=10;
const int PinFanLED= 6;
const int sensorPin = A0;
float sensorValue = 0; // variable to store the value coming from the sensor

Ok. What is then?

You need to describe what you have connected to the Arduino, on which pins. You say that you are using PWM to light the LED, and then you say you are trying to read the voltage to the LED. You can't do both with the same LED.

Pin 9 is connected to potenciometer powering (PWM) the led
Pin A0 is connected in same pot monitoring
You mean this is not corret, I read values but erroneus, I think because the map.

if not correct how can I measure it?

Thanks
but thats not the issue

You mean this is not corret, I read values but erroneus, I think because the map.

Personally, I am really confused. You said that there errors in, and misuse of, the map function were not the source of the problem, but now you think maybe they are.

Pin 9 is connected to potenciometer powering (PWM) the led

Potentiometers are variable resistors. They are not a source of power. If you have a potentiometer, where does PWM come into the picture?

You have described at best one third of the circuit.

Pin A0 is connected in same pot monitoring

Connected where?

We don't ask these questions to annoy you. We ask them because we can't see your hardware or your schematic.

Describe, or take a picture of, or draw a schematic that shows every wire connected to the Arduino.

Post ALL of your code, and any debug output.

Thanks
Its a simple configuration.

Don't you need some connection to ground? Doesn't analogRead() measure voltage relative to ground?

Sorry I forgot to draw the ground, but I just had connected the ground in the PWD pins not in the Analog side.
Both ground are same ground?

Regards

I just had connected the ground in the PWD pins not in the Analog side.

What's a PWD pin?

Thats the configuration core