MG995 360 Servo Arduino Code Continuous Rotation

MG995 Servo Arduino

Tutorial MG995 Servo Motor Arduino Code Continuous Rotation – This time we will learn about the MG995 Servo Motor. The MG995 servo is a servo motor that can move continuously without any degree of rotation limitation.

If you have ever used a servo motor such as the Tower Pro SG90 and MG996R, that servo motor is standard servo type and can be controlled using a specified degree angle.

In the Example program code that can be found on the Arduino IDE for Servo Control, we can easily move the servo motor with the command “myservo.write (degrees);”, then the servo will move to that degree.

The MG995 servo is different in how it operates. I tried programming Arduino several times to control the servo motor from this tower pro using the default program available on the Arduino IDE, but it didn’t work.

So, after I studied and looked for how to control this Continuous servo, I found a way to drive this servo motor.

Because MG995 Tower Pro 360 is a servo type with continuous rotation, there are 3 conditions that must be specified is Stop position, Turn left and Turn right. Of the three positions, the basic command is to use the “writeMicroseconds” command.

Based on several experiments that I did, the microsecond value for when these conditions are:

  • Stop position – writeMicroseconds(1500)
  • Turn left – writeMicroseconds(1000)
  • Turn right – writeMicroseconds (2000)


To be able to practice the values ‚Äč‚Äčabove, please connect the servo to your Arduino. Use it on one of the PWM pins. The PWM pins are 3, 5, 6, 9, 10, and 11. If you don’t know how to assemble them, you can see the circuit here.

Basic Code

After that, I wrote the basic program code below. Please upload a copy of the program line below, then paste it into the Arduino IDE. Then upload it to Arduino Uno.

#include <Servo.h>
Servo servo;
void setup() { 

void loop() { 
// rotate counter-clockwise full-speed

// rotation stopped

// rotate clockwise full-speed

// rotation stopped

You can see the results.

How To Slow Down The Speed

If in a certain position it doesn’t work, for example you can’t turn to the left smoothly, you can try to change the value of the microseconds to a little more or less than the value of 1000.

If you want to make this slowly, you must change the value lower to turn left and higher to turn ringht from .writeMicroseconds(1500).

  • value = 1500 will stop the servo
  • value < 1500 will rotate to the left
    the smaller the value, rotation to the left will be slower.
  • value > 1500 will rotate to the right
    the greater the value, rotation to the right will be slower.

By my experiment, each servo sometimes has a slightly different command than other servo. From that, please calibrate a suitable value of microSeconds for your servo.

I hope this article is useful. If you find this article useful for others, please share this article so that other friends understand how the 360 degree continuous servo MG995 from Tower Pro works.

1 thought on “MG995 360 Servo Arduino Code Continuous Rotation”

  1. Pingback: Adafruit_I2CDevice h No such file or directory - CHIPPIKO

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top