Simple code to run Servo Motor using Arduino Uno

Pane Ki Zid
0

 This article is for those, who are beginners in the field of Arduino Programming. I am sure that you will learn the basics of Arduino programming.

Running Servo Motor Using Arduino Uno

Material Required to run servo motor........
  • Arduino Uno
  • Servo Motor
  • Jumper Wire
  • Code
Step 1: Connect the Jumper wires with the Arduino and Servo motor according to the circuit diagram.

Step 2: Connet the cable to the computer or laptop.

Step 3: Download the Arduino Software and install it on your computer.

Step 4: Instal Servo Library

Step 5: Write the program given below.

#include<Servo.h>
Servo s1;

void setup() {
  //Put your setup code here, to run once:
s1.attach(9);

}

void loop() {
  //Put your main code here, to run repeatedly:
s1.write(0);
delay(1000);
s1.write(180);
delay(1000);
}



Post a Comment

0Comments
Post a Comment (0)