user79787: I have a simple MG996 servo motor and I am trying to make it move with my Arduino Uno. I tried different ways of wiring but nothing seems to work as fully expected.
For the wiring I followed this video: https://www.youtube.com/watch?v=b_xvu6wWafA and at 9:02 min the guy is showing how the wiring is done. As you can see in my photo, I have done the same thing (as you can see in the "my wiring" picture), with an external battery pack and everything but my code still does not work. No errors or anything, compiles and uploads perfectly. The code I was trying to execute is:
#include <Servo.h>

Servo myservo;

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

void loop() {
  myservo.write(0);
  delay(1000);
  myservo.write(90);
  delay(1000);
}

This code is essentially trying to move the servo from 0 to 90 degrees back and forth. The pin is the correct one (#8). The arduino is receiving the right code (because I tried it with exemplary ones).
Important note: One thing I tried, however, was to not even have an external battery pack. Just connect the wires like so but instead of the 2 GNDs, only 1 GND and 1 +5V pin. That way I was able to move the servo only forward but never backwards! And every time I wanted to move it I had to write a higher degree value.
So the question is, is my wiring bad? I must be missing something.
Photos: 

user31668: You have not connected the supply pin properly.
here is the connection diagram for the standard basic Arduino example
I also verified this on the video you have linked. Connect the 5V and you should be good to go.
https://wokwi.com/arduino/projects/306894988845777472


79787: <p>I have a simple MG996 servo motor and I am trying to make it move with my Arduino Uno. I tried different ways of wiring but nothing seems to work as fully expected.</p>
<p>For the wiring I followed this video: <a href="https://www.youtube.com/watch?v=b_xvu6wWafA" rel="nofollow noreferrer">https://www.youtube.com/watch?v=b_xvu6wWafA</a> and at 9:02 min the guy is showing how the wiring is done. As you can see in my photo, I have done the same thing (as you can see in the &quot;my wiring&quot; picture), with an external battery pack and everything but my code still does not work. No errors or anything, compiles and uploads perfectly. The code I was trying to execute is:</p>
<pre><code>#include &lt;Servo.h&gt;

Servo myservo;

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

void loop() {
  myservo.write(0);
  delay(1000);
  myservo.write(90);
  delay(1000);
}
</code></pre>
<p>This code is essentially trying to move the servo from 0 to 90 degrees back and forth. The pin is the correct one (#8). The arduino is receiving the right code (because I tried it with exemplary ones).</p>
<p>Important note: One thing I tried, however, was to not even have an external battery pack. Just connect the wires like so but instead of the 2 GNDs, only 1 GND and 1 +5V pin. That way I was able to move the servo only forward but never backwards! And every time I wanted to move it I had to write a higher degree value.</p>
<p>So the question is, is my wiring bad? I must be missing something.</p>
<p>Photos: <a href="https://i.stack.imgur.com/258V8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/258V8.jpg" alt="My wiring" /></a></p>
 31668: <p>You have not connected the supply pin properly.
here is the connection diagram for the standard basic Arduino example
I also verified this on the video you have linked. Connect the 5V and you should be good to go.</p>
<p><a href="https://wokwi.com/arduino/projects/306894988845777472" rel="nofollow noreferrer">https://wokwi.com/arduino/projects/306894988845777472</a></p>
<p><a href="https://i.stack.imgur.com/TiTAA.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TiTAA.gif" alt="enter image description here" /></a></p>
