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