Industrial Robot based on Arduino Mega 2560 Pro Mini

Published  February 18, 2022   0
T Technical Hacks
Author
Arduino Based Humanoid Robot

Robots are integral part of any industry whether its automobile industry, FMCG industry etc. In the future, when the automation will become dominant compare to manual work, robots will play crucial part in all the processes. So, here you will see an industrial robot that is based on Arduino Mega 2560 Pro Mini. We have previously built many Robotics projects using Arduino.

Component Required for Robot

Hardware Used 

  • Arduino Mega 2560 Pro Mini
  • 19x Servo Motors
  • 12V Battery

Software Used

  • Arduino IDE

Hardware and Software Selection

For this project, I have selected the Arduino Mega 2560 Pro Mini because it is very small, compatible, and low-cost. Here I have used MG995 servos. But you can choose any low budget or small plastic gear servos. But for my project, I needed some heavy servos so I have chosen the MG995 servos. 

Now for the software in case, we can use Eiang IDE. But I have chosen Arduino IDE because it is very much simple and helpful for beginners.

Industrial Robot Circuit Diagram

Here, the nineteen servo motors are connected to the  Arduino Mega 2560 Pro Mini. There are 3 servos for each hand and 6 servos for each of the legs. A servo is also there for the head.  

Industrial Robot Circuit Diagram

Description

Industrial Robot

This Robot can do any task as a normal human can do. It looks similar to a human body. I have used 3D Printed parts to make the Robot body to make it harder and safer for industrial use. Here, to make my robot use for industrial purposes, we need to make it in a little bigger size. Also, we can implant many more features like voice control, camera vision, display, and so on.

Code
#include "Hash_V2.h"

Hash_V2 hashv2;

int degree[20];

int index = 0;

String content = "";

char character;

void setup() {

  Serial.begin(115200);

  Serial.println("GPIO test!");

  hashv2.init_hash();

  hashv2.initial_position();

  delay(5000);

  hashv2.say_hi(2,1000);

  hashv2.forward(5,1000);

  hashv2.turn_right(5,800);

  hashv2.turn_left(5,800);

  hashv2.move_right(5,800);

  hashv2.move_left(5,800);

  hashv2.ball_kick_right(1,1000);

  hashv2.ball_kick_left(1,1000);

  hashv2.max_sit(1, 2000);

  hashv2.bow(1,2000);

  hashv2.right_bow(1,2000);

  hashv2.left_bow(1,2000);

  hashv2.ape_move(3,2000);

  hashv2.push_up(3,3000);

  hashv2.clap(3,2000);

  hashv2.right_leg_up(3, 2000);

  hashv2.left_leg_up(3, 2000);

  hashv2.hip_pose(1, 2000);

  hashv2.right_leg_balance(1, 3000);

  hashv2.left_leg_balance(1, 3000);

  hashv2.flying_action(3, 2000);

  hashv2.hand_sit_zigzak(3, 2000);


}


void loop() {



}

void serialEvent() {

  //Sample serial input: "90,150,150,30,90,90,90,30,30,150,90,90,30,30,30,150,150,150,90,90,"

  String degree;

  degree = Serial.readString();

  //Serial.println(degree);

  executeAngle(degree);

}


void executeAngle(String degree) {

  int angle_array[20], r = 0, t = 0;

  //Serial.println(degree);

  for (int i = 0; i < degree.length(); i++)

  {

    if (degree.charAt(i) == ',')

    {

      angle_array[t] = degree.substring(r, i).toInt();

      r = (i + 1);

      t++;

    }

  }

  for (int i = 0; i < 20; i++) {

    Serial.print(angle_array[i]);

    Serial.print("|");

  }

  Serial.println("");

  hashv2.move_servo(2000, angle_array);

}

class Hash_V2

{

  public:

    /* Variable declaration */

    int servo_position[20];

    float increment[20];

    unsigned long final_time;

    unsigned long partial_time;


    /* Method declaration */

    void init_hash();

    void initial_position();

    void move_servo(int time, int  servo_target[]);


    void say_hi(int count = 1, int speed = 1000);

    void forward(int steps = 1, int speed = 1000);

    void turn_right(int steps = 1, int speed = 1000);

    void turn_left(int steps = 1, int speed = 1000);

    void move_right(int count = 1, int speed = 1000);

    void move_left(int count = 1, int speed = 1000);

    void ball_kick_right(int count = 1, int speed = 1000);

    void ball_kick_left(int count = 1, int speed = 1000);

    void max_sit(int count = 1, int speed = 1000);

    void bow(int count = 1, int speed = 1000);

    void right_bow(int count = 1, int speed = 1000);

    void left_bow(int count = 1, int speed = 1000);

    void ape_move(int count = 1, int speed = 1000);

    void push_up(int count = 1, int speed = 1000);

    void clap(int count = 1, int speed = 1000);

    void right_leg_up(int count = 1, int speed = 1000);

    void left_leg_up(int count = 1, int speed = 1000);

    void hip_pose(int count = 1, int speed = 1000);

    void right_leg_balance(int count = 1, int speed = 3000);

    void left_leg_balance(int count = 1, int speed = 3000);

    void flying_action(int count = 3, int speed = 1000);

    void hand_sit_zigzak(int count = 3, int speed = 2000);

}

#include <Wire.h>

#include <Servo.h>

#include <Adafruit_PWMServoDriver.h>

Servo servo[20] = {};


#include "Hash_V2.h"


/* Initializing servo drive and OLED display */

void Hash_V2::init_hash() {


  int servo_pins[20] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21};


  for (int i = 0; i < 20; i++) {

    servo[i].attach(servo_pins[i]);

  }


}


/* Initial position */

void Hash_V2::initial_position() {

  int degree_array[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  for (int i = 0; i < 20; i++) {

    servo_position[i] = degree_array[i];

  }

  move_servo(2000, degree_array);

}

/* Moving each servo at given time interval */

void Hash_V2::move_servo(int time, int  servo_target[]) {


  if (time > 10) {

    for (int i = 0; i < 20; i++) {

      increment[i] = ((servo_target[i]) - servo_position[i]) / (time / 10.0);

    }

    final_time =  millis() + time;


    for (int iteration = 1; millis() < final_time; iteration++) {

      partial_time = millis() + 10;


      for (int i = 0; i < 20; i++) {

        servo[i].write((int)(servo_position[i] + (iteration * increment[i])));

      }

      while (millis() < partial_time);

    }

  }

  else {

    for (int i = 0; i < 20; i++) {

      servo[i].write((int)servo_target[i]);

    }

  }

  for (int i = 0; i < 20; i++) {

    servo_position[i] = servo_target[i];

  }

}



/******************************************************************************************************/


void Hash_V2::say_hi(int count, int speed) {


  int degree_array1[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 180, 90, 90, 150, 150, 150, 90, 90};

  move_servo(speed * 2, degree_array1);

  for (int i = 1; i <= count; i++) {

    int degree_array2[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 180, 90, 60, 150, 150, 150, 90, 90};

    int degree_array3[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 180, 90, 120, 150, 150, 150, 90, 90};

    move_servo(speed, degree_array2);

    move_servo(speed, degree_array3);

  }

  int degree_array4[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 180, 90, 90, 150, 150, 150, 90, 90};

  int degree_array5[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, degree_array4);

  move_servo(speed * 2, degree_array5);

}


/******************************************************************************************************/


void Hash_V2::forward(int steps, int speed) {

  if (speed < 500) {

    speed = 500;

  }

  int degree_array1[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  int degree_array2[20] = {110, 150, 150, 30, 110, 90, 105, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  int degree_array3[20] = {110, 150, 120, 60, 110, 90, 105, 30, 30, 150, 90, 90, 20, 30, 30, 120, 150, 150, 90, 90};

  int degree_array4[20] = {90, 150, 120, 60, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, degree_array1);

  move_servo(speed, degree_array2);

  move_servo(speed, degree_array3);

  move_servo(speed, degree_array4);

  for (int i = 1; i <= steps; i++) {

    int degree_array5[20] = {70, 150, 150, 30, 90, 90, 70, 30, 30, 150, 70, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    int degree_array6[20] = {70, 150, 150, 30, 90, 90, 70, 30, 60, 120, 70, 90, 60, 30, 30, 160, 150, 150, 90, 90};

    int degree_array7[20] = {90, 150, 150, 30, 90, 90, 90, 30, 60, 120, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    int degree_array8[20] = {110, 150, 150, 30, 110, 90, 105, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    int degree_array9[20] = {110, 150, 120, 60, 110, 90, 105, 30, 30, 150, 90, 90, 20, 30, 30, 120, 150, 150, 90, 90};

    int degree_array10[20] = {90, 150, 120, 60, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    move_servo(speed, degree_array5);

    move_servo(speed, degree_array6);

    move_servo(speed, degree_array7);

    move_servo(speed, degree_array8);

    move_servo(speed, degree_array9);

    move_servo(speed, degree_array10);

  }

  int degree_array11[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, degree_array11);

}


/******************************************************************************************************************/


void Hash_V2::turn_right(int steps, int speed) {

  if (speed < 500) {

    speed = 500;

  }

  int pwm_array1[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, pwm_array1);

  for (int i = 1; i <= steps; i++) {

    int pwm_array2[20] = {70, 150, 150, 30, 90, 90, 70, 30, 30, 150, 70, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    int pwm_array3[20] = {70, 150, 145, 30, 90, 80, 70, 30, 30, 150, 70, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    int pwm_array4[20] = {90, 150, 145, 30, 90, 80, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    int pwm_array5[20] = {110, 150, 150, 30, 110, 80, 105, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    int pwm_array6[20] = {110, 150, 150, 30, 110, 90, 105, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    int pwm_array7[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    move_servo(speed, pwm_array2);

    move_servo(speed, pwm_array3);

    move_servo(speed, pwm_array4);

    move_servo(speed, pwm_array5);

    move_servo(speed, pwm_array6);

    move_servo(speed, pwm_array7);

  }

  int pwm_array8[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, pwm_array8);

}


/******************************************************************************************************/


void Hash_V2::turn_left(int steps, int speed) {

  if (speed < 500) {

    speed = 500;

  }

  int pwm_array1[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, pwm_array1);

  for (int i = 1; i <= steps; i++) {

    int pwm_array2[20] = {110, 150, 150, 30, 110, 90, 105, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    int pwm_array3[20] = {110, 150, 150, 30, 110, 90, 105, 30, 35, 150, 90, 100, 30, 30, 30, 150, 150, 150, 90, 90};

    int pwm_array4[20] = {90, 150, 150, 30, 90, 90, 90, 30, 35, 150, 90, 100, 30, 30, 30, 150, 150, 150, 90, 90};

    int pwm_array5[20] = {70, 150, 150, 30, 90, 90, 70, 30, 30, 150, 70, 100, 30, 30, 30, 150, 150, 150, 90, 90};

    int pwm_array6[20] = {70, 150, 150, 30, 90, 90, 70, 30, 30, 150, 70, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    int pwm_array7[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    move_servo(speed, pwm_array2);

    move_servo(speed, pwm_array3);

    move_servo(speed, pwm_array4);

    move_servo(speed, pwm_array5);

    move_servo(speed, pwm_array6);

    move_servo(speed, pwm_array7);

  }

  int pwm_array8[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, pwm_array8);

}


/******************************************************************************************************/


void Hash_V2::move_right(int steps, int speed) {

  int pwm_array1[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, pwm_array1);

  for (int i = 1; i <= steps; i++) {

    int pwm_array2[20] = {110, 150, 150, 30, 112, 90, 90, 30, 30, 150, 90, 90, 30, 60, 30, 120, 150, 150, 90, 90};

    int pwm_array3[20] = {70, 150, 150, 30, 70, 90, 70, 30, 30, 150, 70, 90, 30, 60, 30, 120, 150, 150, 90, 90};

    int pwm_array4[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    move_servo(speed, pwm_array2);

    move_servo(speed, pwm_array3);

    move_servo(speed, pwm_array4);

  }

  int pwm_array5[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, pwm_array5);

}


/******************************************************************************************************/


void Hash_V2::move_left(int steps, int speed) {

  int pwm_array1[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, pwm_array1);

  for (int i = 1; i <= steps; i++) {

    int pwm_array2[20] = {90, 150, 150, 30, 90, 90, 70, 30, 30, 150, 68, 90, 50, 30, 30, 150, 120, 150, 90, 90};

    int pwm_array3[20] = {110, 150, 150, 30, 110, 90, 110, 30, 30, 150, 110, 90, 50, 30, 30, 150, 120, 150, 90, 90};

    int pwm_array4[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    move_servo(speed, pwm_array2);

    move_servo(speed, pwm_array3);

    move_servo(speed, pwm_array4);

  }

  int pwm_array5[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, pwm_array5);

}


/******************************************************************************************************/


void Hash_V2::ball_kick_right(int count, int speed) {

  int pwm_array1[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, pwm_array1);

  for (int i = 1; i <= count; i++) {

    int pwm_array2[20] = {112, 150, 150, 30, 110, 90, 105, 30, 30, 150, 90, 90, 10, 30, 30, 90, 150, 150, 90, 90};

    int pwm_array3[20] = {112, 130, 140, 10, 110, 90, 105, 30, 30, 150, 90, 90, 10, 30, 30, 90, 150, 150, 90, 90};

    int pwm_array4[20] = {112, 150, 140, 60, 110, 90, 105, 30, 30, 150, 90, 90, 10, 30, 30, 90, 150, 150, 90, 90};

    int pwm_array5[20] = {112, 150, 150, 30, 110, 90, 105, 30, 30, 150, 90, 90, 10, 30, 30, 90, 150, 150, 90, 90};

    move_servo(speed, pwm_array2);

    move_servo(speed / 2, pwm_array3);

    move_servo(speed / 2, pwm_array4);

    move_servo(speed, pwm_array5);

  }

  int pwm_array6[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, pwm_array6);

}


/******************************************************************************************************/


void Hash_V2::ball_kick_left(int count, int speed) {

  int pwm_array1[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, pwm_array1);

  for (int i = 1; i <= count; i++) {

    int pwm_array2[20] = {70, 150, 150, 30, 90, 90, 68, 30, 30, 150, 70, 90, 90, 30, 30, 170, 150, 150, 90, 90};

    int pwm_array3[20] = {70, 150, 150, 30, 90, 90, 68, 50, 40, 170, 70, 90, 90, 30, 30, 170, 150, 150, 90, 90};

    int pwm_array4[20] = {70, 150, 150, 30, 90, 90, 68, 30, 40, 120, 70, 90, 90, 30, 30, 170, 150, 150, 90, 90};

    int pwm_array5[20] = {70, 150, 150, 30, 90, 90, 68, 30, 30, 150, 70, 90, 90, 30, 30, 170, 150, 150, 90, 90};

    move_servo(speed, pwm_array2);

    move_servo(speed / 2, pwm_array3);

    move_servo(speed / 2, pwm_array4);

    move_servo(speed, pwm_array5);

  }

  int pwm_array6[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, pwm_array6);

}


/******************************************************************************************************/


void Hash_V2::max_sit(int count, int speed) {

  for (int i = 1; i <= count; i++) {

    int degree_array1[20] = {90, 70, 60, 30, 90, 90, 90, 110, 120, 150, 90, 90, 30, 60, 30, 150, 120, 150, 90, 90};

    int degree_array2[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    move_servo(speed, degree_array1);

    delay(3000);

    move_servo(speed, degree_array2);

  }

}


/******************************************************************************************************/


void Hash_V2::bow(int count, int speed) {

  for (int i = 1; i <= count; i++) {

    int degree_array1[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 50, 50, 30, 130, 130, 150, 90, 90};

    int degree_array2[20] = {90, 160, 150, 60, 90, 90, 90, 20, 30, 120, 90, 90, 50, 50, 30, 130, 130, 150, 90, 90};

    int degree_array3[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 50, 50, 30, 130, 130, 150, 90, 90};

    move_servo(speed / 2, degree_array1);

    move_servo(speed, degree_array2);

    delay(3000);

    move_servo(speed, degree_array3);

  }

  int pwm_array4[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, pwm_array4);

}


/******************************************************************************************************/


/******************************************************************************************************/


void Hash_V2::right_bow(int count, int speed) {

  for (int i = 1; i <= count; i++) {

    int degree_array1[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 90, 30, 30, 180, 150, 150, 90, 90};

    int degree_array2[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 90, 30, 90, 180, 150, 120, 90, 90};

    int degree_array3[20] = {90, 160, 150, 60, 90, 90, 90, 20, 30, 120, 90, 90, 90, 30, 90, 180, 150, 120, 90, 90};

    int degree_array4[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 90, 30, 90, 180, 150, 120, 90, 90};

    int degree_array5[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 90, 30, 30, 180, 150, 150, 90, 90};

    move_servo(speed, degree_array1);

    move_servo(speed, degree_array2);

    move_servo(speed, degree_array3);

    delay(2000);

    move_servo(speed, degree_array4);

    move_servo(speed, degree_array5);

  }

  int degree_array6[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, degree_array6);

}


/******************************************************************************************************/


void Hash_V2::left_bow(int count, int speed) {

  for (int i = 1; i <= count; i++) {

    int degree_array1[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 0, 30, 30, 90, 150, 150, 90, 90};

    int degree_array2[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 0, 30, 60, 90, 150, 90, 90, 90};

    int degree_array3[20] = {90, 160, 150, 60, 90, 90, 90, 20, 30, 120, 90, 90, 0, 30, 60, 90, 150, 90, 90, 90};

    int degree_array4[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 0, 30, 60, 90, 150, 90, 90, 90};

    int degree_array5[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 0, 30, 30, 90, 150, 150, 90, 90};

    move_servo(speed, degree_array1);

    move_servo(speed, degree_array2);

    move_servo(speed, degree_array3);

    delay(2000);

    move_servo(speed, degree_array4);

    move_servo(speed, degree_array5);

  }

  int degree_array6[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, degree_array6);

}


/******************************************************************************************************/


void Hash_V2::ape_move(int count, int speed) {

  int degree_array1[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 120, 60, 60, 60, 120, 120, 90, 90};

  int degree_array2[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 120, 60, 120, 60, 120, 120, 90, 90};

  move_servo(speed, degree_array1);

  move_servo(speed, degree_array2);

  for (int i = 1; i <= count; i++) {

    int degree_array3[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 120, 60, 60, 60, 120, 60, 120, 90};

    int degree_array4[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 120, 60, 120, 60, 120, 120, 60, 90};

    move_servo(speed / 2, degree_array3);

    move_servo(speed / 2, degree_array4);

  }

  int degree_array5[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 120, 60, 60, 60, 120, 120, 90, 90};

  int degree_array6[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, degree_array5);

  move_servo(speed, degree_array6);

}


/******************************************************************************************************/


void Hash_V2::push_up(int count, int speed) {

  int degree_array1[20] = {90, 70, 60, 30, 90, 90, 90, 110, 120, 150, 90, 90, 30, 60, 30, 150, 120, 150, 90, 90};

  int degree_array2[20] = {90, 70, 60, 30, 150, 90, 90, 110, 120, 150, 30, 90, 30, 60, 30, 150, 120, 150, 90, 90};

  int degree_array3[20] = {90, 70, 60, 30, 150, 90, 90, 110, 120, 150, 30, 90, 90, 30, 30, 90, 150, 150, 90, 90};

  int degree_array4[20] = {90, 70, 60, 0, 150, 90, 90, 110, 120, 180, 30, 90, 90, 30, 30, 90, 150, 150, 90, 90};

  int degree_array5[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 100, 30, 30, 80, 150, 150, 90, 90};

  move_servo(speed, degree_array1);

  move_servo(speed, degree_array2);

  move_servo(speed, degree_array3);

  move_servo(speed, degree_array4);

  move_servo(speed, degree_array5);

  for (int i = 1; i <= count; i++) {

    int degree_array6[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 100, 90, 90, 80, 90, 90, 90, 90};

    int degree_array7[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 100, 30, 30, 80, 150, 150, 90, 90};

    move_servo(speed, degree_array6);

    move_servo(speed, degree_array7);

  }

  int degree_array8[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, degree_array8);

}


/******************************************************************************************************/


void Hash_V2::clap(int count, int speed) {

  int degree_array1[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 180, 20, 30, 0, 160, 150, 90, 90};

  move_servo(speed, degree_array1);

  for (int i = 1; i <= count; i++) {

    int degree_array2[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 180, 20, 90, 0, 160, 90, 90, 90};

    int degree_array3[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 180, 20, 30, 0, 160, 150, 90, 90};

    move_servo(speed / 2, degree_array2);

    move_servo(speed / 2, degree_array3);

  }

  int degree_array4[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, degree_array4);

}


/******************************************************************************************************/


void Hash_V2::right_leg_up(int count, int speed) {

  int degree_array1[20] = {110, 150, 150, 30, 110, 90, 110, 30, 30, 150, 90, 90, 30, 90, 30, 150, 90, 150, 90, 90};

  move_servo(speed, degree_array1);

  for (int i = 1; i <= count; i++) {

    int degree_array2[20] = {110, 150, 150, 30, 110, 90, 110, 30, 30, 150, 90, 90, 30, 150, 30, 150, 30, 150, 90, 90};

    int degree_array3[20] = {110, 150, 150, 30, 110, 90, 110, 30, 30, 150, 90, 90, 30, 90, 30, 150, 90, 150, 90, 90};

    move_servo(speed / 2, degree_array2);

    move_servo(speed / 2, degree_array3);

  }

  int degree_array4[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, degree_array4);

}


/******************************************************************************************************/


void Hash_V2::left_leg_up(int count, int speed) {


  int degree_array1[20] = {70, 150, 150, 30, 90, 90, 70, 30, 30, 150, 70, 90, 30, 90, 30, 150, 90, 150, 90, 90};

  move_servo(speed, degree_array1);

  for (int i = 1; i <= count; i++) {

    int degree_array2[20] = {70, 150, 150, 30, 90, 90, 70, 30, 30, 150, 70, 90, 30, 150, 30, 150, 30, 150, 90, 90};

    int degree_array3[20] = {70, 150, 150, 30, 90, 90, 70, 30, 30, 150, 70, 90, 30, 90, 30, 150, 90, 150, 90, 90};

    move_servo(speed / 2, degree_array2);

    move_servo(speed / 2, degree_array3);

  }


  int degree_array4[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed, degree_array4);

}


/******************************************************************************************************/


void Hash_V2::hip_pose(int count, int speed) {

  for (int i = 1; i <= count; i++) {

    int degree_array1[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 90, 120, 150, 90, 60, 90, 90};

    int degree_array2[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    move_servo(speed, degree_array1);

    delay(3000);

    move_servo(speed, degree_array2);

  }

}


/******************************************************************************************************/


void Hash_V2::right_leg_balance(int count, int speed) {

  for (int i = 1; i <= count; i++) {

    int degree_array1[20] = {70, 150, 150, 30, 90, 90, 70, 30, 30, 150, 70, 90, 30, 90, 30, 150, 90, 150, 90, 90};

    int degree_array2[20] = {70, 150, 150, 30, 90, 90, 70, 110, 120, 150, 70, 90, 30, 90, 30, 150, 90, 150, 90, 90};

    int degree_array3[20] = {70, 150, 150, 30, 90, 90, 70, 30, 30, 150, 70, 90, 30, 90, 30, 150, 90, 150, 90, 90};

    int degree_array4[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    move_servo(speed, degree_array1);

    delay(3000);

    move_servo(speed, degree_array2);

    move_servo(speed, degree_array3);

    move_servo(speed, degree_array4);

  }

}


/******************************************************************************************************/


void Hash_V2::left_leg_balance(int count, int speed) {

  for (int i = 1; i <= count; i++) {

    int degree_array1[20] = {110, 150, 150, 30, 110, 90, 110, 30, 30, 150, 90, 90, 30, 90, 30, 150, 90, 150, 90, 90};

    int degree_array2[20] = {90, 70, 60, 30, 110, 90, 110, 30, 30, 150, 90, 90, 30, 90, 30, 150, 90, 150, 90, 90};

    int degree_array3[20] = {110, 150, 150, 30, 110, 90, 110, 30, 30, 150, 90, 90, 30, 90, 30, 150, 90, 150, 90, 90};

    int degree_array4[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

    move_servo(speed, degree_array1);

    delay(3000);

    move_servo(speed, degree_array2);

    move_servo(speed, degree_array3);

    move_servo(speed, degree_array4);

  }

}


/******************************************************************************************************/


void Hash_V2::flying_action(int count, int speed) {

  int degree_array1[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 120, 30, 150, 60, 150, 90, 90};

  move_servo(speed, degree_array1);

  for (int i = 1; i <= count; i++) {

    int degree_array2[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 150, 90, 150, 30, 90, 90, 90};

    int degree_array3[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 90, 0, 150, 90, 180, 90, 90};

    move_servo(speed / 2, degree_array2);

    move_servo(speed / 2, degree_array3);

  }

  int degree_array4[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 120, 30, 150, 60, 150, 90, 90};

  int degree_array5[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed / 2 , degree_array4);

  move_servo(speed, degree_array5);

}


/******************************************************************************************************/


void Hash_V2::hand_sit_zigzak(int count, int speed) {


  int degree_array1[20] = {90, 100, 95, 30, 90, 90, 90, 80, 85, 150, 90, 90, 30, 120, 120, 150, 60, 60, 90, 90};

  move_servo(speed, degree_array1);

  for (int i = 1; i <= count; i++) {

    int degree_array2[20] = {90, 100, 95, 30, 90, 90, 90, 80, 85, 150, 90, 90, 30, 120, 90, 150, 60, 30, 120, 90};

    int degree_array3[20] = {90, 100, 95, 30, 90, 90, 90, 80, 85, 150, 90, 90, 30, 120, 150, 150, 60, 90, 60, 90};

    move_servo(speed / 2, degree_array2);

    move_servo(speed / 2, degree_array3);

  }

  int degree_array4[20] = {90, 100, 95, 30, 90, 90, 90, 80, 85, 150, 90, 90, 30, 120, 120, 150, 60, 60, 90, 90};

  int degree_array5[20] = {90, 150, 150, 30, 90, 90, 90, 30, 30, 150, 90, 90, 30, 30, 30, 150, 150, 150, 90, 90};

  move_servo(speed / 2 , degree_array4);

  move_servo(speed, degree_array5);

}

/******************************************************************************************************/

Video

Have any question realated to this Article?

Ask Our Community Members