Arduino Beginner Series: Project 17: Controlling a Servo

Hello everyone!! Welcome to this post on Arduino Projects!!
Need a short introduction to what the Arduino is then click on LINK
Check out the breadboard intro right HERE

So this was my first time with Servos! Built a super simple system in which the user tells the servo by what angle it should rotate.

Demo:

So this is what my project turned out like:

Things Required:

  1. Arduino UNO
  2. Jumper Wires
  3. Micro Servo
  4. Arduino IDE on computer

Reference Material:

  1. Link to video I followed (LINK)

Code:

View on/ Download from Github: (Link)

#include<Servo.h>
int servoPin=9;
int servoPos=90;
Servo myservo;

void setup() {
  Serial.begin(9600);
  myservo.attach(servoPin);

}

void loop() {
  Serial.println("What angle for the Servo?");
  while(Serial.available()==0){
    
  }

  servoPos= Serial.parseInt();
  myservo.write(servoPos);
}

Stay Tuned for upcoming posts on Arduino Projects! We’re on the basic newbie projects right now and slowly, gradually move on to those cool, ultra techy projects!! Want to be the first to know when a new and amazing post comes up?? Then feel free to subscribe!

Happy Learning!!

This image has an empty alt attribute; its file name is stay-tuned.gif

Leave a Reply

PHP JS HTML CSS BASH PYTHON CODE

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

search previous next tag category expand menu location phone mail time cart zoom edit close