servo motor (nano)
Arduino Nano Servo Motor Control Servo Motor with Arduino Nano and Potentiometer
Parts Required:
– Arduino NANO v3.0
– Servo motor
– Potentiometer
– Wires
Arduino Code:
// 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);
}
[the-post-grid id=”6170″ title=”Arduino”]
For more Please make sure to subscribe to Officialhrm YouTube channel and like Facebook Page.
Thank you for visiting Officialhrm! Please don’t forget to share this website with your friends.
servo 0 270 drad ???