Menu Close

Arduino Nano Servo Motor

 

Arduino Nano Servo Motor Control Servo Motor with Arduino Nano and Potentiometer

Arduino Nano Servo Motor

Parts Required:

–  Arduino NANO v3.0
–  Servo motor
–  Potentiometer
–  Wires

 

Arduino Code:

Arduino Menu up


// Example by Hisham Marzouk
// Officialhrm.com
#include
<Servo.h>
Servo servo;
int pot = A0;
int readpot;
int res;
void setup() {
// put your setup code here, to run once:
servo.attach(9);
servo.write(0);
pinMode(pot,INPUT);
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
readpot = analogRead(pot);
res = readpot / 6;
Serial.println (res);
servo.write(res);
}

Arduino Menu Down
Arduino Servo

Download: Arduino_servo_potentiometer.ino

 




For more Please make sure to subscribe to Officialhrm YouTube channel and like Facebook Page.

Thank you for visiting OfficialhrmPlease don’t forget to share this website with your friends.

Posted in Arduino

4 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *