Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Yun Jin Yonggledel임동교
Published © GPL3+

Innovation Lab #14 Servo Motor Control

Bongilcheon High School_Innovation Lab Project.

BeginnerProtip10 minutes1,558
Innovation Lab #14 Servo Motor Control

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Arduino Servo Motor
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Servo Motor

Servo Motor

Code

Servo Motor

Arduino
Servo Motor Control
#include <Servo.h>

Servo servo1;


void setup()
{
  servo1.attach(9); 
}


void loop()
{
  deg();
  step_motion();
}

void deg() {
  servo1.write(90); 
  delay(1000);
  servo1.write(180); 
  delay(1000);
  servo1.write(0); 
  delay(1000);
}

void step_motion() {
  int position;
  for (position = 0; position < 180; position += 2) 
  {
    servo1.write(position);
    delay(20);
  }

  for (position = 180; position >= 0; position -= 1) 
  {
    servo1.write(position);
    delay(20);
  }
}

Credits

Yun Jin Yong
6 projects • 10 followers
Contact
gledel
100 projects • 116 followers
Looking back on my childhood, I was happy when I was making something and I was proud of myself. "Making is instinct!"
Contact
임동교
0 projects • 12 followers
Contact

Comments

Please log in or sign up to comment.