Hi everybody, I try to control servo motor with seeed xiao, but there is an error when I compile the example servo code using Arduino IDE 1.8.10. The operation system is Ubuntu 18.04. The code is :
#include <Servo.h>
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
void setup() {
myservo.attach(4); // attaches the servo on pin 9 to the servo object
}
void loop() {
for (pos = 0; pos <= 180; 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 15 ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15 ms for the servo to reach the position
}
}
And the error message:
Arduino: 1.8.10 (Linux), Board: "Seeed XIAO BLE Sense - nRF52840"
/home/nano/Arduino/libraries/Servo/src/nrf52/Servo.cpp: In member function 'void Servo::writeMicroseconds(int)':
/home/nano/Arduino/libraries/Servo/src/nrf52/Servo.cpp:92:33: error: invalid use of incomplete type 'PinDescription {aka struct _PinDescription}'
instance=(g_APinDescription[pin].ulPWMChannel & 0xF0)/16;
^
In file included from /home/nano/Arduino/libraries/Servo/src/nrf52/Servo.cpp:21:0:
/home/nano/.arduino15/packages/Seeeduino/hardware/nrf52/2.6.1/cores/arduino/Arduino.h:80:16: note: forward declaration of 'PinDescription {aka struct _PinDescription}'
typedef struct _PinDescription PinDescription;
^~~~~~~~~~~~~~~
/home/nano/Arduino/libraries/Servo/src/nrf52/Servo.cpp:94:31: error: invalid use of incomplete type 'PinDescription {aka struct _PinDescription}'
channel=g_APinDescription[pin].ulPWMChannel & 0x0F;
^
In file included from /home/nano/Arduino/libraries/Servo/src/nrf52/Servo.cpp:21:0:
/home/nano/.arduino15/packages/Seeeduino/hardware/nrf52/2.6.1/cores/arduino/Arduino.h:80:16: note: forward declaration of 'PinDescription {aka struct _PinDescription}'
typedef struct _PinDescription PinDescription;
^~~~~~~~~~~~~~~
/home/nano/Arduino/libraries/Servo/src/nrf52/Servo.cpp:95:53: error: invalid use of incomplete type 'PinDescription {aka struct _PinDescription}'
group_pins[instance][channel]=g_APinDescription[pin].ulPin;
^
In file included from /home/nano/Arduino/libraries/Servo/src/nrf52/Servo.cpp:21:0:
/home/nano/.arduino15/packages/Seeeduino/hardware/nrf52/2.6.1/cores/arduino/Arduino.h:80:16: note: forward declaration of 'PinDescription {aka struct _PinDescription}'
typedef struct _PinDescription PinDescription;
^~~~~~~~~~~~~~~
/home/nano/Arduino/libraries/Servo/src/nrf52/Servo.cpp: In member function 'int Servo::readMicroseconds()':
/home/nano/Arduino/libraries/Servo/src/nrf52/Servo.cpp:123:33: error: invalid use of incomplete type 'PinDescription {aka struct _PinDescription}'
instance=(g_APinDescription[pin].ulPWMChannel & 0xF0)/16;
^
In file included from /home/nano/Arduino/libraries/Servo/src/nrf52/Servo.cpp:21:0:
/home/nano/.arduino15/packages/Seeeduino/hardware/nrf52/2.6.1/cores/arduino/Arduino.h:80:16: note: forward declaration of 'PinDescription {aka struct _PinDescription}'
typedef struct _PinDescription PinDescription;
^~~~~~~~~~~~~~~
/home/nano/Arduino/libraries/Servo/src/nrf52/Servo.cpp:124:31: error: invalid use of incomplete type 'PinDescription {aka struct _PinDescription}'
channel=g_APinDescription[pin].ulPWMChannel & 0x0F;
^
In file included from /home/nano/Arduino/libraries/Servo/src/nrf52/Servo.cpp:21:0:
/home/nano/.arduino15/packages/Seeeduino/hardware/nrf52/2.6.1/cores/arduino/Arduino.h:80:16: note: forward declaration of 'PinDescription {aka struct _PinDescription}'
typedef struct _PinDescription PinDescription;
^~~~~~~~~~~~~~~
Multiple libraries were found for "Servo.h"
Used: /home/nano/Arduino/libraries/Servo
Not used: /home/nano/Downloads/arduino-1.8.10/libraries/Servo
exit status 1
Error compiling for board Seeed XIAO BLE Sense - nRF52840.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
If somebody can help me, I would be very appreciate for that.