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.