const int pwm = 13 ; //naming pin 13 as ‘pwm’ variable const int adc = 0 ; //naming pin 0 of analog input side as ‘adc’ void setup() { pinMode(pwm,OUTPUT) ; //setting pin 13 as output } void loop() { int adc = analogRead(0) ; //reading analog voltage and storing it in an integer adc = map(adc, 0, 1023, 0, 255); /* ----------map funtion------------the above funtion scales the output of adc, which is 10 bit and gives values btw 0 to 1023, in values btw 0 to 255 form analogWrite funtion which only receives values btw this range */ analogWrite(pwm,adc) ; }