I have a problem with my (simple) circuit.
I connected a LED to digital PIN 5 with a resistor in series, going to ground. A cable goes from +5V to my potentiomenter (right connection). A cable goes from ground to the left connection of my pot. The middle connection of my pot goes to analog pin 2.
My sketch just takes the value from analog pin 2 and does an analogWrite of the same value to my led.
It works almost fine. When I turn the pot shaft, it fades smoothly but then the led goes off (approx. 0.1V) and starts to fade up again as I turn the pot.
I did a serial print to see what values were read by the analog pin 2 and everything is ok. What could be the problem? (I hope my arduino is not damaged! :( )