Skip to main content

How To Run a Servo Motor Using Adriuno



 How To Connect a Servo Motor To Adriuno
                                                                                           Basically servo motor is having three pins positive(red),negative(black),Feedback(yellow) , so easy positive goes to 5V and negative goes to some ground pin  And feedback goes to any digital pin in ardiuno board i would prefer 9th pin


·         Red(positive)         -5V
·         Black(negative)     -ground(gnd)
·         Yellow(feedback) -9th pin(digital)


And the program for servo motor is in ardiuno ide software in (file=>examples=>servo=>sweep)
If you don’t have a ide software don’t worry here program for you



#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}



That is the program for sweeping the servo motor if the program is runs 180 degree in clockwise and rotates 180 degree in counterclockwise simultaneously



Thanks for visiting our site

Comments

Popular posts from this blog

HOW TO DRAW A BIRD

how to draw a bird This web site is for beginners for drawings and oil painters so i am going to show you how to draw a bird . bird drawing is very easy see the pictures below so you can understand easily this oil painting drawing so you can easily draw a bird for clear idea see the video

Best Place For Visiting In INDIA- Meenakshi amman temple

Meenakshi amman temple is a very oldest temple in india. This temple having so many stachus very effectively . in this stachus are created so many thousand years ago . the rate (or) prize of this stachus are expected goes above more than a thousand dollars . many of touristor (or) visitors are keep on coming this temple for so many times . the stachus of this temples are mostly made by a single stone . this temple may takes a 8 th place world wonder because a small things of this temple also be a wonder for human for example in this temple in some places they plotted some metal plates in ground , if a person stands on the metal   he can see the top of the temple by some holes in walls , that is plotted in many places in that temple ,so that so many years ago they are using engineering principles and science techniques .                        ...