Arduino Mega 2560

Servos are fast and strong motors with a limited movement range. You can control SG90, MG996R and other small servo motors with your Ozeki software by providing a desired angle. Each servo has a built in potmeter. It will try to position the motor axis to reach the desired angle. You can discover the minimum and maximum movement range by reading the datasheet. You can simultaneously control as many servo motors as you wish. It also supports the waterproof SM-S8330M with 30 kg torque.

arduino mega 2560 module with servo motor
Figure 1 - Arduino Mega 2560 module with servo motor

Required hardware

  • Arduino Mega 2560
  • Servo Motor(s)

Source code to install on controller


Before you upload this code to your Arduino, please format the EEPROM...
#include <OzIDManager.h>
#include <OzServoController.h>

OzIDManager* manager;
OzServoController* servocontroller;

void setup()
{
  Serial.begin(115200);

  manager = new OzIDManager;
  manager->_sendACK = true;
  manager->_checksum = true;

  OzCommunication::setIDManager(manager);

  servocontroller = new OzServoController;
  //pin 6, MG996R servo (motor min -60, motor max +60), starting angle +5
  servocontroller->AddMotorconfig(6, ServoMotors::SERVO_MG996R, 5);

  int x=1; 
  manager->sendLinkSetup();
  manager->PrintWelcomeLine(servocontroller, x++, "MyServoMotor");
  servocontroller->showMotorDetails();
}

void loop()
{
    OzCommunication::communicate();
}