Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Controlled Micro Servo Motor with Dynamic Positioning

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled Micro Servo Motor with Dynamic Positioning

Circuit Documentation

Summary

This circuit consists of an Arduino UNO microcontroller and a Micro servo 9G. The Arduino UNO is used to control the Micro servo 9G, which is connected to the Arduino's digital pin D9. The servo motor will move to various positions as specified in the Arduino sketch.

Component List

Arduino UNO

Micro servo 9G

Wiring Details

Arduino UNO

Micro servo 9G

Code Documentation

Arduino Sketch

/*
 * This Arduino sketch controls a micro servo motor connected to pin D9.
 * The servo will start at 10 degrees and then move to 130 degrees.
 */

#include <Servo.h>

Servo myServo;  // create servo object to control a servo

void setup() {
  myServo.attach(9);  // attaches the servo on pin 9 to the servo object
  myServo.write(10);  // set initial position to 10 degrees
  delay(1000);        // wait for a second
}

void loop() {
  myServo.write(130); // move servo to 130 degrees
  delay(1000);        // wait for a second
  myServo.write(100);  // move servo back to 10 degrees
  delay(1000);        // wait for a second 
  myServo.write(70);  // move servo back to 10 degrees
  delay(1000);        // wait for a second 
  myServo.write(40);  // move servo back to 10 degrees
  delay(1000);        // wait for a second 
  myServo.write(10);  // move servo back to 10 degrees
  delay(1000);        // wait for a second
  myServo.write(40);  // move servo back to 10 degrees
  delay(1000);        // wait for a second 
  myServo.write(70);  // move servo back to 10 degrees
  delay(1000);        // wait for a second 
  myServo.write(100);  // move servo back to 10 degrees
  delay(1000);        // wait for a second 
  myServo.write(130); // move servo to 130 degrees
}

This code initializes the servo motor and moves it to various positions in a loop. The servo starts at 10 degrees, moves to 130 degrees, and then cycles through several positions before returning to 10 degrees. Each position is held for one second.