Home How to DC Motor Speed Control Using MOSFET byTech Arduino Code •November 18, 2023 Diagram CODE IRF520-MOSFET-Driver made on 28 oct 2020 by Amir Mohammad Shojaee @ Electropeak Home */ #define PWM 3 int pot; int out; void setup() { Serial.begin(9600); pinMode(PWM,OUTPUT); } void loop() { pot=analogRead(A0); out=map(pot,0,1023,0,255); analogWrite(PWM,out); } Facebook Twitter