KRIVANJADIYables
Published © GPL3+

Working with a Micro Servo

This project demonstrates the use of a micro servo.

BeginnerProtip23,421
Working with a Micro Servo

Things used in this project

Story

Read more

Schematics

Circuit Diagram

Schematic Diagram

Breadboard Diagram

Make Connections as shown in the figure.

Code

Code: Micro Servo

Arduino
This program instruct the Servo to rotate smoothly from 0 to 120 degrees
#include <Servo.h>

int i = 0;

int j = 0;

int k = 0;

Servo servo_3;

void setup()
{
  servo_3.attach(3);

}

void loop()
{
  for (i = 0; i <= 120; i += 1) {
    servo_3.write(i);
    delay(50); // Wait for 50 millisecond(s)
  }
  for (k = 120; k >= 0; k -= 1) {
    servo_3.write(k);
    delay(50); // Wait for 50 millisecond(s)
  }
}

Credits

KRIVANJA

KRIVANJA

37 projects • 52 followers
www.krivanja.dev
DIYables

DIYables

0 projects • 79 followers
I would like to invite you to join and add your projects to DIYables platform https://www.hackster.io/diyables

Comments