void setup(){
  pinMode(3, OUTPUT);
  pinMode(A0, INPUT);
  Serial.begin(9600);
}

void loop(){
  int val = analogRead(A0); 
  val = map(val, 0, 1023, 0, 255); 
  Serial.print("Led : ");
  Serial.println(val);
  analogWrite(3, val);
}