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

Awesome Life Hacks in Thread

Awesome thread hacks Hi I am naveen and this is about life hacks using thread video 1. play with your friends Using your hands and thread you can play with your friends one time you’re going to tied your friends hands with thread and you can able to remove this threads using some Unique techniques i am making you tube video about this you can easily do this if you watch the Video 2. fixing the ring if your ring so loose for your finger it’s dangers you will lose it because of it unfitness. here i am having a logic for it if you tide your ring with thread until your finger is tide for the rings see the image you can under stand clearly otherwise see the video below the post it’s easy to know 3. easy spinning toy for kids using threads you can make easy spinning toys for kids it very easy take any bottle cap and make two wholes in parallel tide the wholes with threads and make sure the threads are in same distance. so the toy is ready now an...

what is inside masquito bat