Hello I am new, please help

We are doing an animatronic project and we are trying to program some servo motors using an Arduino Uno. We found a tutorial for this that included a code. We set up the wiring properly and uploaded the code, however the servos aren’t moving. Is there something we need to do with the code to make the servos move? I pasted the code below, any help in deciphering the language would greatly help us to work towards making the code work for our purpose within the animatronic. Thanks in advance.

// Chapter 5 - Motor Control
// Controlling Speed
// By Cornel Amariei for Packt Publishing

// Include the Servo library
#include <Servo.h>

// Declare the Servo pin
int servoPin = 3;
// Create a servo object
Servo Servo1;

void setup() {
// We need to attach the servo to the used pin number

void loop(){
// Make servo go to 0 degrees
// Make servo go to 90 degrees
// Make servo go to 180 degrees

Check your wiring. Are you sure that the servo signal wire is connected to pin 3 of the Uno ?
How is the servo powered ? It is unwise to power it directly from the Arduino 5V and GND pins because of the current required

Put some Serial.print()s in strategic points in the code so that you can track what it is doing. Don't forget to put Serial.begin() in setup()

Your thread title certainly was useless. Nearly every one posting in this section of the forum needs help. That you are new to programming or to the Arduino is irrelevant.

We found a tutorial for this that included a code. We set up the wiring properly

For some undefined, and probably incorrect, definition of properly. We can't see the tutorial OR how you actually wired anything.

The key command to move the servo is, obviously, Servo1.write(). Understanding the values that you write shouldn't be all that challenging.

Thank you for the quick responses guys. Sorry for the unclear title. The reason I posted is because I'm entirely new to Arduino programming and I am relatively new to programming as well. I basically am just trying to learn what the commands within the code mean so that I can change the code to fit our project. The tutorial we used is: https://www.instructables.com/id/Arduino-Servo-Motors/

Our physical setup is identical to the one in this tutorial.

Our physical setup is identical to the one in this tutorial.

We have only your word for that. Since you are an admitted newbie, I have to take that statement with a large grain of salt. At least, post a picture of your wiring.

instructables have a VERY bad rap around here, because so many of them are pure garbage. The one you reference is a case in point. You should NOT be expecting the Arduino to power your servo.

Can you please answer the questions posed in reply #1

The code looks OK so that just leaves the wiring, hardware and power supply.

Have you tried the Sweep example from the Servo library which is known to work as long as you connect the servo to the correct pin ?

One more question. Do you have a real servo or one that has been given a lobotomy and turned into a "continuous rotation servo" ? Can you provide a link to your servo ?


LOTS of servo information here:


POWER is the most common servo problem.

Sorry for the late response guys, I had to get to class.


I didn't think it necessary to post a picture of what there already is a picture of. I assure you our setup is identical to the one in the instructable. It is literally 3 wires connecting a servo to 3 ports. I know I'm a noob, but a monkey could do that.

Though I didn't know the instructables were not all credible, so thank you for bringing this to my attention. I was wondering why no breadboard or anything was involved, as I now understand the Arduino needs something to power it.


Sorry for not answering your questions. Yes, the wire is plugged into port 3. I now realize that nothing was powering the arduino as you guys brought up this point. I have not tried this sweep function, it sounds good so I will be trying this. We got the servos from amazon and I can't seem to find the exact product we bought, but I can post a picture of it tomorrow. Until then, they at least look like this: Amazon.com: Seamuing Micro Servo Motor, MG995 RC Servo, 20kg Metal Gear Servo for RC Robot Arm Helicopter Airplane Remote Control (4PCS): Toys & Games


Thanks for the link. I found some helpful information under connections. Is this section referencing which wire to connect to each port? Thanks again for the reply.

"Servo Black or Brown to Gnd.
Servo Red or Orange (Center wire) to +5V
Servo White or Yellow to Signal (Pin 9)"

Edit: I found a link (Servo - Arduino Reference) that answered the ports question.

"Servo Black or Brown to Gnd.
Servo Red or Orange (Center wire) to +5V
Servo White or Yellow to Signal (Pin 9)"

Hi, Yesy that is the (now Traditional) servo pinout.

GROUND-VOLTAGE-SIGNAL Often abbreviated G-V-S or GVS

That pinout is used by many many other devices. It is what many devices need, and if they only need Ground and Signal like an LED, a pin isn't used.

Years ago my friend Xiao in Beijing thought Arduino should have ALL pins come out to SETS of 3 pins GVS, and he created the (Now Extensively Copied) "Sensor Shield". I have sold thousands of them.

Some guys at Keyes in Shenzhen did a design that I updated to create an Arduino UNO that had ALL the signals brought out to 3-pin header sets. THey also added a switch-mode power supply so that if 9V external power is used, there is 2 amps available at 5V and so you can just plug several servos in. Came out looking like this:

By now you may have learned the danger of asking stuff here when Some People will tell you way more than you asked for :slight_smile: