How to use Continuous 360 Servo with Arduino

Project Video
Project Details

This video explains this code on how to control continuous moving servo or 360 degree servo.

This servo motor is not a real and practical motor. this has been modified to demonstrate very unstable
operation of ther regular servo as contineous serveo. Please use either stepper motor or DC motor with encoder instead.

Project Code

 *  Demonstration of Controlling Continous Servo (360 servo)
 *  this code allows you to control 360 degree servo by a command from Serial Monitor
 * Modified by Ahmad Shamshiri for
 * on Sunday July 01, 2018 at 11:09 in Ajax, Ontario, Canada
 * Watch video instruction of this video:
 * Get this code from
 Original code by BARRAGAN 
 This example code is in the public domain.
 modified 8 Nov 2013
 by Scott Fitzgerald


Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position
int incomingByte = 0;   // for incoming serial data

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object

void loop() {

        // send data only when you receive data:
        if (Serial.available() > 0) {
                // read the incoming byte:
                incomingByte =;

                // say what you got:
                Serial.print("received: ");
                Serial.print (incomingByte);
                if(incomingByte == 108){
                 Serial.println(" sent 0 Rotaing CW "); 
                }else if(incomingByte == 114){
                  Serial.println(" sent 180 Rotaing CCW "); 
                }else if(incomingByte == 60){
                  Serial.println(" sent Stopped "); 
                  Serial.println(" moving Random"); 


If you found this Arduino course helpful, please support me so I can continue creating content like this. support me via PayPal