#define res A0 #define motor 9 void setup(){ pinMode(motor,OUTPUT); } void loop(){ int i = analogRead(res); i = (i*255)/1023; analogWrite(motor,i); }