void setup(){ pinMode(3,INPUT); pinMode(5, OUTPUT); } void loop(){ int x = analogRead(3); int y = map(x,0,1023,0,255); analogWrite(5,y); }