Published

Servo moter with potentiometer

A micro servo motor controlled with a potentiometer

BeginnerShowcase (no instructions)825
Servo moter with potentiometer

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Servos (Tower Pro MG996R)
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×25

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Project Diagram

The diagram for this project, this can be put on a breadboard

Code

Servo Control

C/C++
The code for this project
//Simple Servo
//Written by Ethan Bolvary

#include <Servo.h>

Servo myservo;

int potpin = 0;
int val;

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

void loop() {
  val = analogRead(potpin);
  val = map(val, 0, 1023, 0, 180);
  myservo.write(val);
  delay(15);
}

Credits

Comments