Menu Close

servo motor (nano)

 

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

servo motor (nano)

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

 

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.

Download

File Description Date added File size Downloads
zip Arduino_servo_potentiometer.ino August 15, 2018 4:19 pm 157 KB 289
Posted in Arduino

Related Posts