Mike Zhou
Published © GPL3+

Four-Legged Bionic Spider Robot

ACEBOTT Four-Legged Robot is a learning kit specifically designed for beginners based on ESP8266.

IntermediateProtip3 hours165
Four-Legged Bionic Spider Robot

Things used in this project

Hardware components

ACEBOTT Bionic Spider Kit
×1

Software apps and online services

ACEBOTT APP-IOS
ACEBOTT App-Android

Story

Read more

Schematics

Tutorial of Bionic spider kit

Code

1-Hello ESP32

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

}

void loop() {
  
  Serial.println("Hello, ESP8266!");
  delay(1000);

}

1.2 Servo test

Arduino
#include <Servo.h>

Servo myservo;  // create servo object to control a servo
int pos;
void setup() {
  myservo.attach(D0);  // attaches the servo on GIO2 to the servo objec t
  for (pos = 10; pos <= 170; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 170; pos >= 10; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  delay(1000); 
}

void loop() {
  myservo.write(90);
  }

3.1 zero_0

Arduino
#include <Servo.h>  //Import servo library
//Create eight servos variables
Servo servo_14;//Upper right [paw]
Servo servo_12;//Upper right [arm]
Servo servo_13;//Lower right [arm]
Servo servo_15;//Lower right [paw]
Servo servo_16;//Upper left [paw]
Servo servo_5;//Upper left [arm]
Servo servo_4;//Lower left [arm]
Servo servo_2;//Lower left [paw]

void setup(){ //Initialize the GPIO pin number of each servo
  servo_14.attach(14);
  servo_12.attach(12);
  servo_13.attach(13);
  servo_15.attach(15);
  servo_16.attach(16);
  servo_5.attach(5);
  servo_4.attach(4);
  servo_2.attach(2);
}

void zero() { //Define the zeroing function
  servo_14.write(135);//Set right upper [paw]135°
  servo_12.write(45);//Set upper right [arm]45°
  servo_13.write(135);//Set lower right [arm]135°
  servo_15.write(45);//Set right lower [paw]45°
  servo_16.write(45);//Set upper left [paw]45°
  servo_5.write(135);//Set upper left [arm]135°
  servo_4.write(45);//Set lower left [arm]45°
  servo_2.write(135);//Set left lower [paw]135°
}

void loop() {
  zero();//Call the zeroing function
}

4.1 standby

Arduino
#include <Servo.h>
Servo servo_14;//Upper right [paw]
Servo servo_12;//Upper right [arm]
Servo servo_13;//Lower right [arm]
Servo servo_15;//Lower right [paw]
Servo servo_16;//Upper left [paw]
Servo servo_5;//Upper left [arm]
Servo servo_4;//Lower left [arm]
Servo servo_2;//Lower left [paw]

void setup(){
  servo_14.attach(14);
  servo_12.attach(12);
  servo_13.attach(13);
  servo_15.attach(15);
  servo_16.attach(16);
  servo_5.attach(5);
  servo_4.attach(4);
  servo_2.attach(2);
}
//Create the standby array
int array1[2][9] = {
  //G14  G12  G13  G15  G16  G5  G4  G2  MS
  {90,  90,  90,  90,  90,  90,  90,  90,  500},//Center point position
  {70,  90,  90,  110, 110,  90,  90,  70,  500},//Standby mode
};
//A function that sets the standby state
void standby() {
 for (int i = 0; i <= 1; i = i + 1) {  //There are two sets of arrays that need to be traversed twice
  servo_14.write(array1[i][0]); //The servo executes row i and column 1
  servo_12.write(array1[i][1]); //The servo executes row i and column 2
  servo_13.write(array1[i][2]); //The servo executes row i and column 3
  servo_15.write(array1[i][3]); //The servo executes row i and column 4
  servo_16.write(array1[i][4]); //The servo executes row i and column 5
  servo_5.write(array1[i][5]); //The servo executes row i and column 6
  servo_4.write(array1[i][6]); //The servo executes row i and column 7
  servo_2.write(array1[i][7]); //The servo executes row i and column 8
  delay(array1[i][8]); //Row i, column 9, execution delay time
 }
}
//Run the standby function
void loop() {
  standby();
  delay(1000);
}

4.2 forward

Arduino
#include <Servo.h>
Servo servo_14;//Upper right [paw]
Servo servo_12;//Upper right [arm]
Servo servo_13;//Lower right [arm]
Servo servo_15;//Lower right [paw]
Servo servo_16;//Upper left [paw]
Servo servo_5;//Upper left [arm]
Servo servo_4;//Lower left [arm]
Servo servo_2;//Lower left [paw]

//Creates an array of action decompositions for moving forward
int array2[11][9] = { //There are 11 arrays with 9 columns
//G14  G12  G13  G15  G16  G5  G4  G2  MS (The latter is uniformly sorted according to this pin)
 {70, 90, 90, 110, 110, 90, 90, 70, 200},//Ready for standby
 {90, 90, 90, 110, 110, 90, 90, 90, 200},//Right upper paw and left lower paw are raised
 {90, 120, 90, 110, 110, 90, 60, 90, 200},//Right upper arm and left lower arm forward
 {70, 120, 90, 110, 110, 90, 60, 70, 200},//Right upper paw and left lower paw drop
 {70, 120, 90, 90, 90, 90, 60, 70, 200},//The left upper paw and right lower paw are raised
 {70, 90, 90, 90, 90, 90, 90, 70, 200},//Right upper arm and left lower arm back
 {70, 90, 120,90, 90, 60, 90, 70, 200},//Left upper arm and right lower arm forward
 {70, 90, 120,110, 110, 60, 90, 70, 200},//Left upper paw and right lower paw drop
 {90, 90, 120,110, 110, 60, 90, 90, 200},//Right upper paw and left lower paw are raised
 {90, 90, 90, 110, 110, 90, 90, 90, 200},//The upper left arm and lower right arm back
 {70, 90, 90, 110, 110, 90, 90, 70, 200},//Right upper paw and left lower paw drop
};
//Sets the forward function

void forward() {
  for (int i = 0; i <= 10; i = i + 1) {
    servo_14.write(array2[i][0]);
    servo_12.write(array2[i][1]);
    servo_13.write(array2[i][2]);
    servo_15.write(array2[i][3]);
    servo_16.write(array2[i][4]);
    servo_5.write(array2[i][5]);
    servo_4.write(array2[i][6]);
    servo_2.write(array2[i][7]);
    delay(array2[i][8]);
    }
}

void setup(){
  servo_14.attach(14);
  servo_12.attach(12);
  servo_13.attach(13);
  servo_15.attach(15);
  servo_16.attach(16);
  servo_5.attach(5);
  servo_4.attach(4);
  servo_2.attach(2);
}

// Run the forward function (to pause, put the swing switch on the servo extension board into OFF gear)
void loop() {
  forward();// The robot may not necessarily walk in a straight line due to errors
}

4.3 back

Arduino
#include <Servo.h>
Servo servo_14;//Upper right [paw]
Servo servo_12;//Upper right [arm]
Servo servo_13;//Lower right [arm]
Servo servo_15;//Lower right [paw]
Servo servo_16;//Upper left [paw]
Servo servo_5;//Upper left [arm]
Servo servo_4;//Lower left [arm]
Servo servo_2;//Lower left [paw]

//Creates a backward-moving action decomposition array
int array3[11][9] = {
 {70, 90, 90, 110, 110, 90, 90, 70, 200},//Ready for standby
 {90, 90, 90, 110, 110, 90, 90, 90, 200},//Right upper paw and left lower paw are raised
 {90, 60, 90, 110, 110, 90, 120,90, 200},//Right upper arm and left lower arm back
 {70, 60, 90, 110, 110, 90, 120,70, 200},//Right upper paw and left lower paw drop 
 {70, 60, 90, 90, 90, 90, 120,70, 200},//The left upper paw and right lower paw are raised
 {70, 90, 90, 90, 90, 90, 90, 70, 200},//Right upper arm and left lower arm forward 
 {70, 90, 60, 90, 90, 120,90, 70, 200},//The upper left arm and lower right arm back
 {70, 90, 60,110, 110, 120,90, 70, 200},//Left upper paw and right lower paw drop
 {90, 90, 60,110, 110, 120,90, 90, 200},//Right upper paw and left lower paw are raised
 {90, 90, 90, 110, 110, 90, 90, 90, 200},//Left upper arm and right lower arm forward
 {70, 90, 90, 110, 110, 90, 90, 70, 200},//Right upper paw and left lower paw drop
};

//Sets the backoff function

void back() {
 for (int i = 0; i <= 10; i = i + 1) {
  servo_14.write(array3[i][0]);
  servo_12.write(array3[i][1]);
  servo_13.write(array3[i][2]);
  servo_15.write(array3[i][3]);
  servo_16.write(array3[i][4]);
  servo_5.write(array3[i][5]);
  servo_4.write(array3[i][6]);
  servo_2.write(array3[i][7]);
  delay(array3[i][8]);
 }
}

void setup(){
  servo_14.attach(14);
  servo_12.attach(12);
  servo_13.attach(13);
  servo_15.attach(15);
  servo_16.attach(16);
  servo_5.attach(5);
  servo_4.attach(4);
  servo_2.attach(2);
}

//Running the backoff program
void loop() {
  back();//Calling the backoff function
}

4.4 expand

Arduino
#include <Servo.h>
Servo servo_14;//Upper right [paw]
Servo servo_12;//Upper right [arm]
Servo servo_13;//Lower right [arm]
Servo servo_15;//Lower right [paw]
Servo servo_16;//Upper left [paw]
Servo servo_5;//Upper left [arm]
Servo servo_4;//Lower left [arm]
Servo servo_2;//Lower left [paw]


//Create the standby array
int array1[2][9] = {
//G14  G12  G13  G15  G16  G5  G4  G2  MS
{90,  90,  90,  90,  90,  90,  90,  90,  500},//Center point position
  {70,  90,  90,  110, 110,  90,  90,  70,  500},//Standby mode
};

//Creates an array of action decompositions for moving forward
int array2[11][9] = { //There are 11 arrays with 9 columns
//G14  G12  G13  G15  G16  G5  G4  G2  MS (The latter is uniformly sorted according to this pin)
 {70, 90, 90, 110, 110, 90, 90, 70, 200},//Ready for standby
 {90, 90, 90, 110, 110, 90, 90, 90, 200},//Right upper paw and left lower paw are raised
 {90, 120, 90, 110, 110, 90, 60, 90, 200},//Right upper arm and left lower arm forward
 {70, 120, 90, 110, 110, 90, 60, 70, 200},//Right upper paw and left lower paw drop
 {70, 120, 90, 90, 90, 90, 60, 70, 200},//The left upper paw and right lower paw are raised
 {70, 90, 90, 90, 90, 90, 90, 70, 200},//Right upper arm and left lower arm back
 {70, 90, 120,90, 90, 60, 90, 70, 200},//Left upper arm and right lower arm forward
 {70, 90, 120,110, 110, 60, 90, 70, 200},//Left upper paw and right lower paw drop
 {90, 90, 120,110, 110, 60, 90, 90, 200},//Right upper paw and left lower paw are raised
 {90, 90, 90, 110, 110, 90, 90, 90, 200},//The upper left arm and lower right arm back
 {70, 90, 90, 110, 110, 90, 90, 70, 200},//Right upper paw and left lower paw drop
};

//Creates a backward-moving action decomposition array
int array3[11][9] = {
 {70, 90, 90, 110, 110, 90, 90, 70, 200},//Ready for standby
 {90, 90, 90, 110, 110, 90, 90, 90, 200},//Right upper paw and left lower paw are raised
 {90, 60, 90, 110, 110, 90, 120,90, 200},//Right upper arm and left lower arm back
 {70, 60, 90, 110, 110, 90, 120,70, 200},//Right upper paw and left lower paw drop 
 {70, 60, 90, 90, 90, 90, 120,70, 200},//The left upper paw and right lower paw are raised
 {70, 90, 90, 90, 90, 90, 90, 70, 200},//Right upper arm and left lower arm forward 
 {70, 90, 60, 90, 90, 120,90, 70, 200},//The upper left arm and lower right arm back
 {70, 90, 60,110, 110, 120,90, 70, 200},//Left upper paw and right lower paw drop
 {90, 90, 60,110, 110, 120,90, 90, 200},//Right upper paw and left lower paw are raised
 {90, 90, 90, 110, 110, 90, 90, 90, 200},//Left upper arm and right lower arm forward
 {70, 90, 90, 110, 110, 90, 90, 70, 200},//Right upper paw and left lower paw drop
};

//A function that sets the standby state
void standby() {
 for (int i = 0; i <= 1; i = i + 1) {  //There are two sets of arrays that need to be traversed twice
  servo_14.write(array1[i][0]); //The servo executes row i and column 1
  servo_12.write(array1[i][1]); //The servo executes row i and column 2
  servo_13.write(array1[i][2]); //The servo executes row i and column 3
  servo_15.write(array1[i][3]); //The servo executes row i and column 4
  servo_16.write(array1[i][4]); //The servo executes row i and column 5
  servo_5.write(array1[i][5]); //The servo executes row i and column 6
  servo_4.write(array1[i][6]); //The servo executes row i and column 7
  servo_2.write(array1[i][7]); //The servo executes row i and column 8
  delay(array1[i][8]); //Row i, column 9, execution delay time
  }
}

//Sets the forward function
void forward() {
for (int i = 0; i <= 10; i = i + 1) {
servo_14.write(array2[i][0]);
servo_12.write(array2[i][1]);
servo_13.write(array2[i][2]);
servo_15.write(array2[i][3]);
servo_16.write(array2[i][4]);
servo_5.write(array2[i][5]);
servo_4.write(array2[i][6]);
servo_2.write(array2[i][7]);
delay(array2[i][8]);
}
}

//Sets the backoff function
void back() {
 for (int i = 0; i <= 10; i = i + 1) {
servo_14.write(array3[i][0]);
servo_12.write(array3[i][1]);
servo_13.write(array3[i][2]);
servo_15.write(array3[i][3]);
servo_16.write(array3[i][4]);
servo_5.write(array3[i][5]);
servo_4.write(array3[i][6]);
servo_2.write(array3[i][7]);
delay(array3[i][8]);
 }
}

void setup(){
servo_14.attach(14);
servo_12.attach(12);
servo_13.attach(13);
servo_15.attach(15);
servo_16.attach(16);
servo_5.attach(5);
servo_4.attach(4);
servo_2.attach(2);
}

void loop() {
  for (int i = 0; i <= 2; i = i + 1){
    forward();//Move forward three times
  }
  for (int i = 0; i <= 1; i = i + 1){
    back();//Move backwards twice
  }
  standby();//Standby mode
  }

5.1 turn_left

Arduino
#include <Servo.h>
Servo servo_14;//Upper right [paw]
Servo servo_12;//Upper right [arm]
Servo servo_13;//Lower right [arm]
Servo servo_15;//Lower right [paw]
Servo servo_16;//Upper left [paw]
Servo servo_5;//Upper left [arm]
Servo servo_4;//Lower left [arm]
Servo servo_2;//Lower left [paw]


//Create an array of turns to the left. By default, the robot rotates 22.5 degrees
int array6[8][9] = {
//G14  G12  G13  G15  G16  G5  G4  G2  MS 
{70, 90, 90, 110, 110, 90, 90, 70, 200},//Ready for standby
{90, 90, 90, 110, 110, 90, 90, 90, 200},//Right upper paw and left lower paw are raised
{90, 135, 90, 110, 110, 90,135, 90, 200},//Right upper arm forward, left lower arm back
{70, 135, 90, 110, 110, 90,135, 70, 200},//Right upper paw and left lower paw drop
{70, 135, 90, 90, 90, 90, 135, 70, 200},//The left upper paw and right lower paw are raised
{70, 135, 135, 90, 90, 135,135, 70, 200},//Put your upper left arm back and your lower right arm forward
{70, 135, 135, 110, 110, 135,135, 70, 200},//Left upper paw and right lower paw drop
{70, 90, 90, 110, 110, 90, 90, 70, 200},//Four arms rotation
};
//A function that sets the left turn
void turnleft() {
 for (int i = 0; i <= 7; i = i + 1) {
  servo_14.write(array6[i][0]);
  servo_12.write(array6[i][1]);
  servo_13.write(array6[i][2]);
  servo_15.write(array6[i][3]);
  servo_16.write(array6[i][4]);
  servo_5.write(array6[i][5]);
  servo_4.write(array6[i][6]);
  servo_2.write(array6[i][7]);
  delay(array6[i][8]);
 }
}

void setup(){
  servo_14.attach(14);
  servo_12.attach(12);
  servo_13.attach(13);
  servo_15.attach(15);
  servo_16.attach(16);
  servo_5.attach(5);
  servo_4.attach(4);
  servo_2.attach(2);
}

//Run the left turn 
void loop() {
  turnleft();
}

5.2 turn_right

Arduino
#include <Servo.h>
Servo servo_14;//Upper right [paw]
Servo servo_12;//Upper right [arm]
Servo servo_13;//Lower right [arm]
Servo servo_15;//Lower right [paw]
Servo servo_16;//Upper left [paw]
Servo servo_5;//Upper left [arm]
Servo servo_4;//Lower left [arm]
Servo servo_2;//Lower left [paw]


//Create an array of actions for turning right (for setting the rotation Angle, see instructions for turning left arrays)
int array7[8][9] = {
 {70, 90, 90, 110, 110, 90, 90, 70, 200},//Ready for standby
 {70, 90, 90, 90, 90, 90, 90, 70, 200},//The left upper paw and right lower paw are raised
 {70, 90, 45, 90, 90, 45, 90, 70, 200},//The upper left arm goes forward and the lower right arm goes back
 {70, 90, 45, 110, 110, 45, 90, 70, 200},//Left upper paw and right lower paw drop
 {90, 90, 45, 110, 110, 45, 90, 90, 200},//Right upper paw and left lower paw are raised
 {90, 45, 45, 110, 110, 45, 45, 90, 200},//Right upper arm back, left lower arm forward
 {70, 45, 45, 110, 110, 45, 45, 70, 200},//Right upper paw and left lower paw drop
 {70, 90, 90, 110, 110, 90, 90, 70, 200},//Four arms rotation
};
//A function that sets the right turn
void turnright() {
 for (int i = 0; i <= 7; i = i + 1) {
  servo_14.write(array7[i][0]);
  servo_12.write(array7[i][1]);
  servo_13.write(array7[i][2]);
  servo_15.write(array7[i][3]);
  servo_16.write(array7[i][4]);
  servo_5.write(array7[i][5]);
  servo_4.write(array7[i][6]);
  servo_2.write(array7[i][7]);
  delay(array7[i][8]);
 }
}

void setup(){
  servo_14.attach(14);
  servo_12.attach(12);
  servo_13.attach(13);
  servo_15.attach(15);
  servo_16.attach(16);
  servo_5.attach(5);
  servo_4.attach(4);
  servo_2.attach(2);
}

//Run the right turn
void loop() {
  turnright();
}

5.3expand2

Arduino
#include <Servo.h>
Servo servo_14;//Upper right [paw]
Servo servo_12;//Upper right [arm]
Servo servo_13;//Lower right [arm]
Servo servo_15;//Lower right [paw]
Servo servo_16;//Upper left [paw]
Servo servo_5;//Upper left [arm]
Servo servo_4;//Lower left [arm]
Servo servo_2;//Lower left [paw]


//Creates an array of action decompositions for moving forward
int array2[11][9] = { //There are 11 arrays with 9 columns
//G14  G12  G13  G15  G16  G5  G4  G2  MS (The latter is uniformly sorted according to this pin)
 {70, 90, 90, 110, 110, 90, 90, 70, 200},//Ready for standby
 {90, 90, 90, 110, 110, 90, 90, 90, 200},//Right upper paw and left lower paw are raised
 {90, 120, 90, 110, 110, 90, 60, 90, 200},//Right upper arm and left lower arm forward
 {70, 120, 90, 110, 110, 90, 60, 70, 200},//Right upper paw and left lower paw drop
 {70, 120, 90, 90, 90, 90, 60, 70, 200},//The left upper paw and right lower paw are raised
 {70, 90, 90, 90, 90, 90, 90, 70, 200},//Right upper arm and left lower arm back
 {70, 90, 120,90, 90, 60, 90, 70, 200},//Left upper arm and right lower arm forward
 {70, 90, 120,110, 110, 60, 90, 70, 200},//Left upper paw and right lower paw drop
 {90, 90, 120,110, 110, 60, 90, 90, 200},//Right upper paw and left lower paw are raised
 {90, 90, 90, 110, 110, 90, 90, 90, 200},//The upper left arm and lower right arm back
 {70, 90, 90, 110, 110, 90, 90, 70, 200},//Right upper paw and left lower paw drop
};



//Create an array of turns to the left. By default, the robot rotates 22.5 degrees
int array6[8][9] = {
//G14  G12  G13  G15  G16  G5  G4  G2  MS 
{70, 90, 90, 110, 110, 90, 90, 70, 200},//Ready for standby
{90, 90, 90, 110, 110, 90, 90, 90, 200},//Right upper paw and left lower paw are raised
{90, 135, 90, 110, 110, 90,135, 90, 200},//Right upper arm forward, left lower arm back
{70, 135, 90, 110, 110, 90,135, 70, 200},//Right upper paw and left lower paw drop
{70, 135, 90, 90, 90, 90, 135, 70, 200},//The left upper paw and right lower paw are raised
{70, 135, 135, 90, 90, 135,135, 70, 200},//Put your upper left arm back and your lower right arm forward
{70, 135, 135, 110, 110, 135,135, 70, 200},//Left upper paw and right lower paw drop
{70, 90, 90, 110, 110, 90, 90, 70, 200},//Four arms rotation
};

//Create an array of actions for turning right (for setting the rotation Angle, see instructions for turning left arrays)
int array7[8][9] = {
 {70, 90, 90, 110, 110, 90, 90, 70, 200},//Ready for standby
 {70, 90, 90, 90, 90, 90, 90, 70, 200},//The left upper paw and right lower paw are raised
 {70, 90, 45, 90, 90, 45, 90, 70, 200},//The upper left arm goes forward and the lower right arm goes back
 {70, 90, 45, 110, 110, 45, 90, 70, 200},//Left upper paw and right lower paw drop
 {90, 90, 45, 110, 110, 45, 90, 90, 200},//Right upper paw and left lower paw are raised
 {90, 45, 45, 110, 110, 45, 45, 90, 200},//Right upper arm back, left lower arm forward
 {70, 45, 45, 110, 110, 45, 45, 70, 200},//Right upper paw and left lower paw drop
 {70, 90, 90, 110, 110, 90, 90, 70, 200},//Four arms rotation
};

//Sets the forward function
void forward() {
for (int i = 0; i <= 10; i = i + 1) {
servo_14.write(array2[i][0]);
servo_12.write(array2[i][1]);
servo_13.write(array2[i][2]);
servo_15.write(array2[i][3]);
servo_16.write(array2[i][4]);
servo_5.write(array2[i][5]);
servo_4.write(array2[i][6]);
servo_2.write(array2[i][7]);
delay(array2[i][8]);
}
}


//A function that sets the left turn
void turnleft() {
 for (int i = 0; i <= 7; i = i + 1) {
  servo_14.write(array6[i][0]);
  servo_12.write(array6[i][1]);
  servo_13.write(array6[i][2]);
  servo_15.write(array6[i][3]);
  servo_16.write(array6[i][4]);
  servo_5.write(array6[i][5]);
  servo_4.write(array6[i][6]);
  servo_2.write(array6[i][7]);
  delay(array6[i][8]);
 }
}

//A function that sets the right turn
void turnright() {
 for (int i = 0; i <= 7; i = i + 1) {
  servo_14.write(array7[i][0]);
  servo_12.write(array7[i][1]);
  servo_13.write(array7[i][2]);
  servo_15.write(array7[i][3]);
  servo_16.write(array7[i][4]);
  servo_5.write(array7[i][5]);
  servo_4.write(array7[i][6]);
  servo_2.write(array7[i][7]);
  delay(array7[i][8]);
 }
}


void setup(){
  servo_14.attach(14);
  servo_12.attach(12);
  servo_13.attach(13);
  servo_15.attach(15);
  servo_16.attach(16);
  servo_5.attach(5);
  servo_4.attach(4);
  servo_2.attach(2);
}

//Four edges need to repeat forward and rotation actions four times, preferentially using the traversal loop.
void loop() {
 for (int i = 0; i <= 3; i = i + 1){
   for (int i = 0; i <= 2; i = i + 1){
     forward(); //Three times forward
  }
   for (int i = 0; i <= 3; i = i + 1){
     turnright(); //One rotate it four times to the right, which is about 90 degrees
  }
 }
}

6.1left_move

Arduino
#include <Servo.h>
Servo servo_14;//Upper right [paw]
Servo servo_12;//Upper right [arm]
Servo servo_13;//Lower right [arm]
Servo servo_15;//Lower right [paw]
Servo servo_16;//Upper left [paw]
Servo servo_5;//Upper left [arm]
Servo servo_4;//Lower left [arm]
Servo servo_2;//Lower left [paw]


//Create an array of moves to the left
int array4[11][9] = {
{70, 90, 90, 110, 110, 90, 90, 70, 200},//Ready for standby
{70, 90, 90, 90, 90, 90, 90, 70, 200},//The left upper paw and right lower paw are raised
{70, 90, 60, 90, 90, 120,90, 70, 200},//The upper left arm and lower right arm back
{70, 90, 60, 110, 110, 120,90, 70, 200},//Left upper paw and right lower paw drop
{90, 90, 60, 110, 110, 120,90, 90, 200},//Right upper paw and left lower paw are raised
{90, 90, 90, 110, 110, 90, 90, 90, 200},//Left upper arm and right lower arm forward
{90, 120,90, 110, 110, 90, 60, 90, 200},//Right upper arm and left lower arm forward
{70, 120,90, 110, 110, 90, 60, 70, 200},//Right upper paw and left lower paw drop
{70, 120,90, 90, 90, 90, 60, 70, 200},//The left upper paw and right lower paw are raised
{70, 90, 90, 90, 90, 90, 90, 70, 200},//Right upper arm and left lower arm back
{70, 90, 90, 110, 110, 90, 90, 70, 200},//Left upper paw and right lower paw drop
};

//Sets the function to move to the left
void leftmove() {
 for (int i = 0; i <= 10; i = i + 1) {
  servo_14.write(array4[i][0]);
  servo_12.write(array4[i][1]);
  servo_13.write(array4[i][2]);
  servo_15.write(array4[i][3]);
  servo_16.write(array4[i][4]);
  servo_5.write(array4[i][5]);
  servo_4.write(array4[i][6]);
  servo_2.write(array4[i][7]);
delay(array4[i][8]);
 }
}

void setup() {
  servo_14.attach(14);
  servo_12.attach(12);
  servo_13.attach(13);
  servo_15.attach(15);
  servo_16.attach(16);
  servo_5.attach(5);
  servo_4.attach(4);
  servo_2.attach(2);

}


// Run the program moved to the left
void loop() {
  leftmove();
}

6.2right_move

Arduino
#include <Servo.h>
Servo servo_14;//Upper right [paw]
Servo servo_12;//Upper right [arm]
Servo servo_13;//Lower right [arm]
Servo servo_15;//Lower right [paw]
Servo servo_16;//Upper left [paw]
Servo servo_5;//Upper left [arm]
Servo servo_4;//Lower left [arm]
Servo servo_2;//Lower left [paw]


//Create an array of actions to move to the right
int array5[11][9] = {
{70, 90, 90, 110, 110, 90, 90, 70, 200},//Ready for standby
{90, 90, 90, 110, 110, 90, 90, 90, 200},//Right upper paw and left lower paw are raised
{90, 60, 90, 110, 110, 90, 120,90, 200},//Right upper arm and left lower arm back
{70, 60, 90, 110, 110, 90, 120,70, 200},//Right upper paw and left lower paw drop
{70, 60, 90, 90, 90, 90, 120,70, 200},//The left upper paw and right lower paw are raised
{70, 90, 90, 90, 90, 90, 90, 70, 200},//Right upper arm and left lower arm forward
{70, 90, 120,90, 90, 60, 90, 70, 200},//Left upper arm and right lower arm forward
{70, 90, 120,110, 110, 60, 90, 70, 200},//Left upper paw and right lower paw drop
{90, 90, 120,110, 110, 60, 90, 90, 200},//Right upper paw and left lower paw are raised
{90, 90, 90, 110, 110, 90, 90, 90, 200},//The upper left arm and lower right arm back
{70, 90, 90, 110, 110, 90, 90, 70, 200},//Right upper paw and left lower paw drop
};

//Sets the function to move to the right
void rightmove() {
 for (int i = 0; i <= 10; i = i + 1) {
  servo_14.write(array5[i][0]);
  servo_12.write(array5[i][1]);
  servo_13.write(array5[i][2]);
  servo_15.write(array5[i][3]);
  servo_16.write(array5[i][4]);
  servo_5.write(array5[i][5]);
  servo_4.write(array5[i][6]);
  servo_2.write(array5[i][7]);
  delay(array5[i][8]);
 }
}

void setup() {
  servo_14.attach(14);
  servo_12.attach(12);
  servo_13.attach(13);
  servo_15.attach(15);
  servo_16.attach(16);
  servo_5.attach(5);
  servo_4.attach(4);
  servo_2.attach(2);

}

// Run the program moved to the right
void loop() {
rightmove();
}

6.3say_hello

Arduino
#include <Servo.h>
Servo servo_14;//Upper right [paw]
Servo servo_12;//Upper right [arm]
Servo servo_13;//Lower right [arm]
Servo servo_15;//Lower right [paw]
Servo servo_16;//Upper left [paw]
Servo servo_5;//Upper left [arm]
Servo servo_4;//Lower left [arm]
Servo servo_2;//Lower left [paw]

//Create an array of hello actions
int array8[7][9] = {
 {70, 90, 135, 90, 90, 90, 90, 90, 400},//Left upper paw, right lower paw, left lower paw down
 {170, 90, 135, 90, 90, 90, 90, 90, 400},//Right upper paw raised
 {170, 130, 135, 90, 90, 90, 90, 90, 400},//Swing your right upper arm forward
 {170, 50, 135, 90, 90, 90, 90, 90, 400},//Swing your right upper arm back
 {170, 130, 135, 90, 90, 90, 90, 90, 400},//Swing your right upper arm forward
 {170, 90, 135, 90, 90, 90, 90, 90, 400},//Swing your right upper arm back
 {70, 90, 135, 90, 90, 90, 90, 90, 400},//Right upper arm down
};

//Set the hello function
void hello() {
 for (int i = 0; i <= 6; i = i + 1) {
  servo_14.write(array8[i][0]); 
  servo_12.write(array8[i][1]);
  servo_13.write(array8[i][2]);
  servo_15.write(array8[i][3]);
  servo_16.write(array8[i][4]);
  servo_5.write(array8[i][5]);
  servo_4.write(array8[i][6]);
  servo_2.write(array8[i][7]);
  delay(array8[i][8]);
 }
}

void setup() {
  servo_14.attach(14);
  servo_12.attach(12);
  servo_13.attach(13);
  servo_15.attach(15);
  servo_16.attach(16);
  servo_5.attach(5);
  servo_4.attach(4);
  servo_2.attach(2);
}

// Run the hello program
void loop() {
  hello();
}

7.1dance1

Arduino
#include <Servo.h>
Servo servo_14;//Upper right [paw]
Servo servo_12;//Upper right [arm]
Servo servo_13;//Lower right [arm]
Servo servo_15;//Lower right [paw]
Servo servo_16;//Upper left [paw]
Servo servo_5;//Upper left [arm]
Servo servo_4;//Lower left [arm]
Servo servo_2;//Lower left [paw]

//Create an action array for the elementary step
int array9[10][9] = {
{90, 90, 90, 90, 90, 90, 90, 90, 400},//Lift all four paws
{50, 90, 90, 90, 90, 90, 90, 90, 400},//Right upper paw down
{90, 90, 90, 130, 90, 90, 90, 90, 400},//Right upper paw up, right lower paw down
{90, 90, 90, 90, 90, 90, 90, 50, 400},//Right lower paw up , left lower paw down
{90, 90, 90, 90, 130, 90, 90, 90, 400},//Left upper paw down, left lower paw up
{50, 90, 90, 90, 90, 90, 90, 90, 400},//Left upper paw up, right upper paw down
{90, 90, 90, 130, 90, 90, 90, 90, 400},//Right upper paw up, right lower paw down
{90, 90, 90, 90, 90, 90, 90, 50, 400},//Right lower paw up,left lower paw down
{90, 90, 90, 90, 130, 90, 90, 90, 400},//Left upper paw down, left lower paw up
{90, 90, 90, 90, 90, 90, 90, 90, 400},//Left upper paw up
};

//A function to set the elementary steps
void dance1() {
 for (int i = 0; i <= 9; i = i + 1) {
  servo_14.write(array9[i][0]);
  servo_12.write(array9[i][1]);
  servo_13.write(array9[i][2]);
  servo_15.write(array9[i][3]);
  servo_16.write(array9[i][4]);
  servo_5.write(array9[i][5]);
  servo_4.write(array9[i][6]);
  servo_2.write(array9[i][7]);
  delay(array9[i][8]);
 }
}

void setup() {
  servo_14.attach(14);
  servo_12.attach(12);
  servo_13.attach(13);
  servo_15.attach(15);
  servo_16.attach(16);
  servo_5.attach(5);
  servo_4.attach(4);
  servo_2.attach(2);

}

//Run the program for the elementary step
void loop() {
  dance1();
  delay(1000);
}

7.2dance2

Arduino
#include <Servo.h>
Servo servo_14;//Upper right [paw]
Servo servo_12;//Upper right [arm]
Servo servo_13;//Lower right [arm]
Servo servo_15;//Lower right [paw]
Servo servo_16;//Upper left [paw]
Servo servo_5;//Upper left [arm]
Servo servo_4;//Lower left [arm]
Servo servo_2;//Lower left [paw]

//Create an action array for intermediate steps
int array10[9][9] = {
{70, 45, 135, 110, 110, 135, 45, 70, 400},//The four arms are left and right together
{115, 45, 135, 65, 110, 135, 45, 70, 400},//Right upper paw and right lower paw are raised
{70, 45, 135, 110, 65, 135, 45, 115, 400},//Right upper and lower paws down,left upper and lower paws up
{115, 45, 135, 65, 110, 135, 45, 70, 400},//Left upper and lower paws down,right upper and lower paws up
{70, 45, 135, 110, 65, 135, 45, 115, 400},//Right upper and lower paws down,left upper and lower paws up
{115, 45, 135, 65, 110, 135, 45, 70, 400},//Left upper and lower paws down,right upper and lower paws up
{70, 45, 135, 110, 65, 135, 45, 115, 400},//Right upper and lower paws down,left upper and lower paws up
{115, 45, 135, 65, 110, 135, 45, 70, 400},//Left upper and lower paws down,right upper and lower paws up
{75, 45, 135, 105, 110, 135, 45, 70, 400},//Right upper paw and right lower paw down
};

//A function to set intermediate steps
void dance2() {
 for (int i = 0; i <= 8; i = i + 1) {
  servo_14.write(array10[i][0]);
  servo_12.write(array10[i][1]);
  servo_13.write(array10[i][2]);
  servo_15.write(array10[i][3]);
  servo_16.write(array10[i][4]);
  servo_5.write(array10[i][5]);
  servo_4.write(array10[i][6]);
  servo_2.write(array10[i][7]);
  delay(array10[i][8]);
 }
}

void setup() {
  servo_14.attach(14);
  servo_12.attach(12);
  servo_13.attach(13);
  servo_15.attach(15);
  servo_16.attach(16);
  servo_5.attach(5);
  servo_4.attach(4);
  servo_2.attach(2);

}

//Run the intermediate step program
void loop() {
  dance2();
  delay(1000);
}

7.3dance3

Arduino
#include <Servo.h>
Servo servo_14;//Upper right [paw]
Servo servo_12;//Upper right [arm]
Servo servo_13;//Lower right [arm]
Servo servo_15;//Lower right [paw]
Servo servo_16;//Upper left [paw]
Servo servo_5;//Upper left [arm]
Servo servo_4;//Lower left [arm]
Servo servo_2;//Lower left [paw]

//Create an action array for advanced steps
int array11[10][9] = {
{70, 45, 45, 110, 110, 135, 135, 70, 400},//All four arms back
{90, 45, 45, 60, 90, 135, 135, 70, 400},//Right upper paw, left upper paw, right lower paw up
{70, 45, 45, 110, 110, 135, 135, 70, 400},//Right upper paw, left upper paw and right lower paw down
{90, 45, 45, 110, 90, 135, 135, 120, 400},//Right upper paw, left upper paw, left lower paw up
{70, 45, 45, 110, 110, 135, 135, 70, 400},//Right upper paw, left upper paw and left lower paw down
{90, 45, 45, 60, 90, 135, 135, 70, 400},//Right upper paw, left upper paw, right lower paw up
{70, 45, 45, 110, 110, 135, 135, 70, 400},//Right upper paw, left upper paw and right lower paw down
{90, 45, 45, 110, 90, 135, 135, 120, 400},//Right upper paw, left upper paw, left lower paw up
{70, 45, 45, 110, 110, 135, 135, 70, 400},//Right upper paw, left upper paw and left lower paw down
{70, 90, 90, 110, 110, 90, 90, 70, 400},//Standby mode
};

//A function to set advanced steps
void dance3() {
 for (int i = 0; i <= 9; i = i + 1) {
  servo_14.write(array11[i][0]);
  servo_12.write(array11[i][1]);
  servo_13.write(array11[i][2]);
  servo_15.write(array11[i][3]);
  servo_16.write(array11[i][4]);
  servo_5.write(array11[i][5]);
  servo_4.write(array11[i][6]);
  servo_2.write(array11[i][7]);
  delay(array11[i][8]);
 }
}

void setup() {
  servo_14.attach(14);
  servo_12.attach(12);
  servo_13.attach(13);
  servo_15.attach(15);
  servo_16.attach(16);
  servo_5.attach(5);
  servo_4.attach(4);
  servo_2.attach(2);

}
//Run the advanced step program
void loop() {
  dance3();
  delay(1000);
}

7.4expand

Arduino
#include <Servo.h>
Servo servo_14;//Upper right [paw]
Servo servo_12;//Upper right [arm]
Servo servo_13;//Lower right [arm]
Servo servo_15;//Lower right [paw]
Servo servo_16;//Upper left [paw]
Servo servo_5;//Upper left [arm]
Servo servo_4;//Lower left [arm]
Servo servo_2;//Lower left [paw]
String item;//Because serial data is in string format, the variables are also in string format

//Create the standby array
int array1[2][9] = {
//G14  G12  G13  G15  G16  G5  G4  G2  MS
{90,  90,  90,  90,  90,  90,  90,  90,  500},//Center point position
  {70,  90,  90,  110, 110,  90,  90,  70,  500},//Standby mode
};

//dance1
int array9[10][9] = {
{90, 90, 90, 90, 90, 90, 90, 90, 400},
{50, 90, 90, 90, 90, 90, 90, 90, 400},
{90, 90, 90, 130, 90, 90, 90, 90, 400},
{90, 90, 90, 90, 90, 90, 90, 50, 400},
{90, 90, 90, 90, 130, 90, 90, 90, 400},
{50, 90, 90, 90, 90, 90, 90, 90, 400},
{90, 90, 90, 130, 90, 90, 90, 90, 400},
{90, 90, 90, 90, 90, 90, 90, 50, 400},
{90, 90, 90, 90, 130, 90, 90, 90, 400},
{90, 90, 90, 90, 90, 90, 90, 90, 400},
};

//dance2
int array10[9][9] = {
{70, 45, 135, 110, 110, 135, 45, 70, 400},
{115, 45, 135, 65, 110, 135, 45, 70, 400},
{70, 45, 135, 110, 65, 135, 45, 115, 400},
{115, 45, 135, 65, 110, 135, 45, 70, 400},
{70, 45, 135, 110, 65, 135, 45, 115, 400},
{115, 45, 135, 65, 110, 135, 45, 70, 400},
{70, 45, 135, 110, 65, 135, 45, 115, 400},
{115, 45, 135, 65, 110, 135, 45, 70, 400},
{75, 45, 135, 105, 110, 135, 45, 70, 400},
};

//dance3
int array11[10][9] = {
{70, 45, 45, 110, 110, 135, 135, 70, 400},
{90, 45, 45, 60, 90, 135, 135, 70, 400},
{70, 45, 45, 110, 110, 135, 135, 70, 400},
{90, 45, 45, 110, 90, 135, 135, 120, 400},
{70, 45, 45, 110, 110, 135, 135, 70, 400},
{90, 45, 45, 60, 90, 135, 135, 70, 400},
{70, 45, 45, 110, 110, 135, 135, 70, 400},
{90, 45, 45, 110, 90, 135, 135, 120, 400},
{70, 45, 45, 110, 110, 135, 135, 70, 400},
{70, 90, 90, 110, 110, 90, 90, 70, 400},
};

//A function that sets the standby state
void standby() {
 for (int i = 0; i <= 1; i = i + 1) {  //There are two sets of arrays that need to be traversed twice
  servo_14.write(array1[i][0]); //The servo executes row i and column 1
  servo_12.write(array1[i][1]); //The servo executes row i and column 2
  servo_13.write(array1[i][2]); //The servo executes row i and column 3
  servo_15.write(array1[i][3]); //The servo executes row i and column 4
  servo_16.write(array1[i][4]); //The servo executes row i and column 5
  servo_5.write(array1[i][5]); //The servo executes row i and column 6
  servo_4.write(array1[i][6]); //The servo executes row i and column 7
  servo_2.write(array1[i][7]); //The servo executes row i and column 8
  delay(array1[i][8]); //Row i, column 9, execution delay time
 }
}


void dance1() {
for (int i = 0; i <= 9; i = i + 1) {
 servo_14.write(array9[i][0]);
 servo_12.write(array9[i][1]);
 servo_13.write(array9[i][2]);
 servo_15.write(array9[i][3]);
 servo_16.write(array9[i][4]);
 servo_5.write(array9[i][5]);
 servo_4.write(array9[i][6]);
 servo_2.write(array9[i][7]);
 delay(array9[i][8]);
}
}


void dance2() {
for (int i = 0; i <= 8; i = i + 1) {
 servo_14.write(array10[i][0]);
 servo_12.write(array10[i][1]);
 servo_13.write(array10[i][2]);
 servo_15.write(array10[i][3]);
 servo_16.write(array10[i][4]);
 servo_5.write(array10[i][5]);
 servo_4.write(array10[i][6]);
 servo_2.write(array10[i][7]);
 delay(array10[i][8]);
}
}


void dance3() {
for (int i = 0; i <= 9; i = i + 1) {
 servo_14.write(array11[i][0]);
 servo_12.write(array11[i][1]);
 servo_13.write(array11[i][2]);
 servo_15.write(array11[i][3]);
 servo_16.write(array11[i][4]);
 servo_5.write(array11[i][5]);
 servo_4.write(array11[i][6]);
 servo_2.write(array11[i][7]);
 delay(array11[i][8]);
}
}


void setup() {
 servo_14.attach(14);
 servo_12.attach(12);
 servo_13.attach(13);
 servo_15.attach(15);
 servo_16.attach(16);
 servo_5.attach(5);
 servo_4.attach(4);
 servo_2.attach(2);
 standby();
 Serial.begin(115200);
 item = "";//Initialize the variable as an empty string
}

// Don't select \r\n in serial port, just select no
void loop() {   // Run the serial control dance program
  //Determine whether there is data in the serial port
  if (Serial.available()) { 
    item = Serial.readString(); //The variable is assigned to the data read by the serial port
    Serial.println(item); //The serial port prints out the input data

  //According to the input data, the condition is judged and the corresponding function is executed
  if (item == "1") { //When 1 is input to the serial port, dance1 is executed
    dance1();
    }
  if (item == "2") { //When 2 is input to the serial port, dance2 is executed
    dance2();
    }
  if (item == "3") { //When 3 is input to the serial port, dance3 is executed
    dance3();
    }
  }
}

8.1app_control

Arduino
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include "text.h"

const char* ssid = "QuadBot-E";
const char* password = "12345678";

WiFiServer server(100);
WiFiClient client;
String sendBuff;
byte RX_package[17] = {0};
byte callback_forward_package[5] = {0xff,0x55,0x02,0x01,0x01};
byte callback_back_package[5] = {0xff,0x55,0x02,0x01,0x02};
byte callback_leftmove_package[5] = {0xff,0x55,0x02,0x01,0x03};
byte callback_rightmove_package[5] = {0xff,0x55,0x02,0x01,0x04};
byte callback_turnleft_package[5] = {0xff,0x55,0x02,0x01,0x05};
byte callback_turnright_package[5] = {0xff,0x55,0x02,0x01,0x06};
byte Serial_package[5] = {0};
byte dataLen, index_a = 0;
char buffer[52];
unsigned char prevc=0;
bool isStart = false;
bool ED_client = true;
bool WA_en = false;

#define CMD_RUN 1
#define CMD_daiji 3
#define CMD_jiaozun 4
#define CMD_suijiao 5
#define CMD_padi 6
#define CMD_dazaohu 7
#define CMD_fuwoceng 8
#define CMD_zandou 9
#define CMD_dance1 10
#define CMD_dance2 11
#define CMD_dance3 12

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

  WiFi.mode(WIFI_AP);
  WiFi.softAP(ssid,password,5);
  server.begin();
  delay(100);

  servo_14.attach(14, SERVOMIN, SERVOMAX);
  servo_12.attach(12, SERVOMIN, SERVOMAX);
  servo_13.attach(13, SERVOMIN, SERVOMAX);
  servo_15.attach(15, SERVOMIN, SERVOMAX);
  servo_16.attach(16, SERVOMIN, SERVOMAX);
  servo_5.attach(5, SERVOMIN, SERVOMAX);
  servo_4.attach(4, SERVOMIN, SERVOMAX);
  servo_2.attach(2, SERVOMIN, SERVOMAX);

  Servo_PROGRAM_Zero();
}
unsigned char readBuffer(int index_r)
{
  return buffer[index_r]; 
}
void writeBuffer(int index_w,unsigned char c)
{
  buffer[index_w]=c;
}
void runModule(int device)
{
  switch(device) 
  {
    case 0x0C:
    {   
      int val = readBuffer(12);
      switch (val)
      {
        case 0x01:       
            forward();//Serial.println("ok");
            //Serial.write(callback_forward_package,5);
            client.write(callback_forward_package,5);
            break;
        case 0x02:
            back();
            client.write(callback_back_package,5);
            break;
        case 0x03:
            leftmove();
            client.write(callback_leftmove_package,5);
            break;
        case 0x04:
            rightmove();
            client.write(callback_rightmove_package,5);
            break;
        case 0x05:
            turnleft();
            client.write(callback_turnleft_package,5);
            break;
        case 0x06:
            turnright();
            client.write(callback_turnright_package,5);
            break;
        default:
            break;
      }
    }break;
  }   
}
void parseData()
{ 
  isStart = false;
  int action = readBuffer(9);
  int device = readBuffer(10);
  switch(action)
  {
    case CMD_RUN:
    {
      runModule(device);
    }
    break;
    case CMD_daiji:
    {
      standby();//Serial.println("ok");
    }
    break;
    case CMD_jiaozun:
    {
      //zero();
    }
    break;
    case CMD_suijiao:
    {
      sleep();
    }
    break;
    case CMD_padi:
    {
      lie();
    }
    break;
    case CMD_dazaohu:
    {
      hello();
    }
    break;
    case CMD_fuwoceng:
    {
      pushup();
    }
    break;
    case CMD_zandou:
    {
      fighting();
    }
    break;
    case CMD_dance1:
    {
      dance1();
    }
    break;
    case CMD_dance2:
    {
      dance2();
    }
    break;
    case CMD_dance3:
    {
      dance3();
    }
    break;
  }
}
void loop()
{
  client = server.available();
  if (client)
  {
    WA_en = true;
    ED_client = true;
    Serial.println("[Client connected]");

    while (client.connected())
    {
      if (client.available())
      {
        unsigned char c = client.read()&0xff;
        Serial.write(c);
        if(c==0x55&&isStart==false)
        {
          if(prevc==0xff)
          {
            index_a=1; 
            isStart = true;
          }
        }
        else
        {
          prevc = c;
          if(isStart)
          {
            if(index_a==2)
            {
            dataLen = c; 
            }
            else if(index_a>2)
            {
              dataLen--;
            }
            writeBuffer(index_a,c);
          }
        }
        index_a++;
        if(index_a>120)
        {
          index_a=0; 
          isStart=false;
        }
        if(isStart&&dataLen==0&&index_a>3)
        { 
          isStart = false;
          parseData();
          index_a=0;
        }
      }
      if (Serial.available())
      {
        char c = Serial.read();
        sendBuff += c;
        client.print(sendBuff);
        Serial.print(sendBuff);
        sendBuff = "";
      }
      static unsigned long Test_time = 0;
      if (millis() - Test_time > 1000)
      {
        Test_time = millis();
        if (0 == (WiFi.softAPgetStationNum()))
        {
          //Serial.write(Stop,17);
          break;
        }
      }
    }
    //Serial.write(Stop,17);
    client.stop();
    Serial.println("[Client disconnected]");
  }
  else
  {
    if (ED_client == true)
    {
      ED_client = false;
      //Serial.write(Stop,17);
    }
  }
}

Credits

Mike Zhou

Mike Zhou

2 projects • 0 followers

Comments