2 programs integration error "Servo.h" found multiple libraries

Hello, what I am doing now is Google’s coral dev board development board to send the signal to the arduino, and finally turn the sg90 motor.
Now it is possible to send signals to arduino and arduino alone to control the motor, but there will be this error when the two programs are integrated.
:
“Servo.h” found multiple libraries
已使用: /home/must/下載/arduino-1.8.10-linux64/arduino-1.8.10/libraries/Servo
exit status 1
expected declaration before ‘}’ token

Below is my program (this one controls the motor individually):

#include <Servo.h>   

Servo myservo;  // 建立SERVO物件


void setup() {
  myservo.attach(6);  // 設定要將伺服馬達接到哪一個PIN腳
}

void loop() {   
  myservo.write(0);  //旋轉到0度,就是一般所說的歸零
  delay(1000);
  myservo.write(90); //旋轉到90度
  delay(1000);
  myservo.write(180); //旋轉到180度
  delay(1000);
  myservo.write(0);
  delay(1000);
}

這支是dev board傳訊號後arduino接收到在傳回來:

void setup()
{
  Serial.begin(115200); // 9600 bps
}
void loop()
{
  if ( Serial.available())
    {
      if('s' == Serial.read())
        Serial.println("Hello Raspberry,I am Arduino.");
     }
}

最後整合有錯誤的是這支:

#include <Servo.h>   //載入函式庫,這是內建的,不用安裝
int i;
Servo myservo;  // 建立SERVO物件

void setup() {
  myservo.attach(6);  // 設定要將伺服馬達接到哪一個PIN腳
  Serial.begin(115200);
}

void loop() {   
  if(Serial.available())
  {
    if('1'==Serial.read())
     myservo.write(0);  //旋轉到0度,就是一般所說的歸零
  delay(1000);
  myservo.write(90); //旋轉到90度
  delay(1000);
  myservo.write(0);
  delay(1000);
  }
     if('2'==Serial.read())
     myservo.write(0); 
  delay(1000);
  myservo.write(100); //旋轉到100度
  delay(1000);
  myservo.write(0);
  delay(1000);
  }
}

youwei:
... but there will be this error when the two programs are integrated.

Post the 'integrated' code.

Use the IDE autoformat tool (ctrl-t or Tools, Auto Format) and you will see that you have an extra curly bracket (}) to close the loop() function.

Your code after autoformat:

#include <Servo.h>   //載入函式庫,這是內建的,不用安裝
int i;
Servo myservo;  // 建立SERVO物件

void setup()
{
   myservo.attach(6);  // 設定要將伺服馬達接到哪一個PIN腳
   Serial.begin(115200);
}

void loop()
{
   if (Serial.available())
   {
      if ('1' == Serial.read())
         myservo.write(0);  //旋轉到0度,就是一般所說的歸零
      delay(1000);
      myservo.write(90); //旋轉到90度
      delay(1000);
      myservo.write(0);
      delay(1000);
   }
   if ('2' == Serial.read())
      myservo.write(0);
   delay(1000);
   myservo.write(100); //旋轉到100度
   delay(1000);
   myservo.write(0);
   delay(1000);
}
}  // ***  this curly bracket is extra and causes your error  ****  remove it *****

Also, multiple libraries typically doesn't throw out an error. its usual just a warning. Probably something else threw up the error. Like a missing function or something.

-jim lee