WARNING: library Servo claims to run on avr, megaavr, sam, samd, nrf52, stm32f4, mbed, mbed_nano, mbed_portenta, mbed_rp2040, renesas, renesas_portenta, renesas_uno architecture(s) and may be incompatible with your current board which runs on esp32 architecture(s).
In file included from C:\Users\User\AppData\Local\Temp\.arduinoIDE-unsaved2023915-9464-1ubxlv3.i3ot\sketch_oct15b\sketch_oct15b.ino:25:
C:\Users\User\AppData\Local\Arduino15\libraries\Servo\src/Servo.h:79:2: error: #error "This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor."
#error "This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor."
^~~~~
exit status 1
Compilation error: exit status 1
Can someone tell me what is the problem that i having here right now? i cant seem to figure it out.
Hi @gwynethchiew. The error message correctly explains the problem to you:
The "Servo" library you are using in your sketch is not compatible with the ESP32 board.
You will need to use an alternative library. You can find several of them by searching for esp32 servo in the Arduino IDE Library Manager.
After installing the ESP32-compatible servo library, you can learn about how to use it by studying the demonstration sketches provided by the library author, which you will find under the File > Examples menu in Arduino IDE>
The error message clearly states that the Servo library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor. Your board has an ESP32 processor. So it's not supported by the library. What is it that you don't understand?
I can suggest the "ESP32Servo" library. I recently used this library successfully with my Nano ESP32 board.
The Nano ESP32 is different from your ESP-WROOM-32-based board in that the Nano ESP32 uses the ESP32-S3 microcontroller instead of the classic ESP32 microcontroller. So I can't guarantee that you will have the same results from using the library as I did, but I think there is a good chance the library will work fine for you. If it doesn't just find a different candidate library in Library Manager (e.g., "ServoESP32") and give that one a try.
i tried searching and downloading both ESP32Servo and ServoESP32, and now there's a new problem-
In file included from C:\Users\User\AppData\Local\Temp\.arduinoIDE-unsaved2023915-9464-1ubxlv3.i3ot\sketch_oct15b\sketch_oct15b.ino:10:
c:\Users\User\abu Dropbox\chiang hiawlee\PC\Documents\Arduino\libraries\ServoESP32\src/Servo.h:68:81: error: call to non-'constexpr' function 'const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]'
static const int TIMER_RESOLUTION = std::min(16, SOC_LEDC_TIMER_BIT_WIDE_NUM);
^
c:\Users\User\abu Dropbox\chiang hiawlee\PC\Documents\Arduino\libraries\ServoESP32\src/Servo.h: In member function 'T ServoTemplate<T>::mapTemplate(T, T, T, T, T) const':
c:\Users\User\abu Dropbox\chiang hiawlee\PC\Documents\Arduino\libraries\ServoESP32\src/Servo.h:256:28: error: 'is_floating_point_v' is not a member of 'std'
if constexpr (std::is_floating_point_v<T>) {
^~~~~~~~~~~~~~~~~~~
c:\Users\User\abu Dropbox\chiang hiawlee\PC\Documents\Arduino\libraries\ServoESP32\src/Servo.h:256:28: note: suggested alternative: 'is_floating_point'
if constexpr (std::is_floating_point_v<T>) {
^~~~~~~~~~~~~~~~~~~
is_floating_point
c:\Users\User\abu Dropbox\chiang hiawlee\PC\Documents\Arduino\libraries\ServoESP32\src/Servo.h:256:49: error: expected primary-expression before '>' token
if constexpr (std::is_floating_point_v<T>) {
^
c:\Users\User\abu Dropbox\chiang hiawlee\PC\Documents\Arduino\libraries\ServoESP32\src/Servo.h:256:50: error: expected primary-expression before ')' token
if constexpr (std::is_floating_point_v<T>) {
^
Multiple libraries were found for "Servo.h"
Used: C:\Users\User\abu Dropbox\chiang hiawlee\PC\Documents\Arduino\libraries\ServoESP32
Not used: C:\Users\User\AppData\Local\Arduino15\libraries\Servo
exit status 1
Compilation error: exit status 1
Have you tried any of the example programs bundled with your new library to familiarize yourself with any changes you might have to make to your code to accommodate the new library?