DrOpShOtZ
Published

Arduino Servo Sweep

Sweeps the shaft of a RC servo motor back and forth across 180 degrees.

BeginnerProtip2,512
Arduino Servo Sweep

Things used in this project

Hardware components

Jumper wires (generic)
Jumper wires (generic)
×3
Arduino UNO
Arduino UNO
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

SERVO MOTOR SWEEP ARDUINO

The circuit diagram

Code

SERVO MOTOR SWEEP ARDUINO

Arduino
#include <Servo.h>

Servo myservo;

int pos = 0;

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

void loop() {
  for (pos = 0; pos <= 180; pos += 1)
  {
    myservo.write(pos);
    delay(15);
  }
  for (pos = 180; pos >= 0; pos -= 1)
  {
    myservo.write(pos);
    delay(15); 
  }
}

Credits

DrOpShOtZ

DrOpShOtZ

12 projects • 17 followers
Contact me from Discord. DrOpShOtZ#6290

Comments