Control LED brightness by potentiometer

The wiper of the potentiometer is read by analog input which in turn is mapped to a PWM controlled digital pin leading to a LED.


The arduino code uses float to map the analog input value to the digital PWM. Using unsigned long does for the same operation does not work as can be seen from the serial trace output.