void setup() { // put your setup code here, to run once: pinMode(9,OUTPUT); // Digital pin 9 will be used as PWM output } void loop() { // put your main code here, to run repeatedly: uint16_t value =analogRead(A0); //reading the value of potantiometer fro mA0 pin uint16_t newValue =map(value,0,1023,0,255); // map the values comes from pot from 0-1023 to the 0-255 analogWrite(9,newValue); // write it pin9 }