# Compile error when trying to use ESP32Servo library for UNO R4 WiFi

**URL:** <https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946>\
**Category:** General Guidance\
**Created:** [February 15, 2026, 3:56pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946 "2026-02-15T15:56:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohan\_us](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mohan_us/32/1126558_2.png) [@mohan\_us](https://forum.arduino.cc/u/mohan_us)\
**Post date:** [February 15, 2026, 3:56pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/1 "2026-02-15T15:56:12Z")

</div>

Please help a newbie and forgive my ignorance.

I have Uno R4 WiFi board which I need to use to control a linear actuator. Here is the board information returned by the IDE:

```arduino
BN: Arduino UNO R4 WiFi
VID: 0x2341
PID: 0x1002
SN: 34B7DA637A40

```

I am following the Servo Guide at "DroneBot Workshop" and getting an error at the very first line of the example sketches in this guide. That line is:

```arduino
#include "ESP32Servo.h"

```

The compile/verify error is:

```arduino
In file included from /Users/Mohan/Documents/Arduino/libraries/ESP32Servo/src/ESP32Servo.h:84:0,
from /private/var/folders/8x/0wjsj3bn4pj_dc1lhdnm5m9w0000gn/T/.arduinoIDE-unsaved2026115-6424-11wdq99.rtge/sketch_feb15a/sketch_feb15a.ino:1:
/Users/Mohan/Documents/Arduino/libraries/ESP32Servo/src/ESP32PWM.h:28:10: fatal error: esp32-hal-ledc.h: No such file or directory
#include "esp32-hal-ledc.h"
^ ~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

```

```arduino
Compilation error: exit status

```

I have been doing lot of independent research for the past 24 hours without any practical hint and ready to give up.

I would greatly appreciate any practical advice in getting past this issue.

---

<div class="post-metadata">

**Author:** ![kmin](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kmin/32/1147370_2.png) [@kmin](https://forum.arduino.cc/u/kmin)\
**Post date:** [February 15, 2026, 4:09pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/2 "2026-02-15T16:09:07Z")

</div>

The Uno R4 WiFi uses a Renesas RA4M1, not an ESP32. So that library cannot compile on it.  
Just go with normal servo.h arduino library.

---

<div class="post-metadata">

**Author:** ![Railroader](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/railroader/32/274550_2.png) [@Railroader](https://forum.arduino.cc/u/Railroader)\
**Post date:** [February 15, 2026, 4:13pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/3 "2026-02-15T16:13:01Z")

</div>

> [@mohan\_us](#):
>
> a linear actuator

Posting a link to its datasheet will tell what stuff You’ve got.

---

<div class="post-metadata">

**Author:** ![mohan\_us](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mohan_us/32/1126558_2.png) [@mohan\_us](https://forum.arduino.cc/u/mohan_us)\
**Post date:** [February 15, 2026, 4:21pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/4 "2026-02-15T16:21:40Z")

</div>

Thanks. I can’t even compile something as simple as the following:

#include "ESP32Servo.h"

void setup() {  
// put your setup code here, to run once:

}

void loop() {  
// put your main code here, to run repeatedly:

}

The linear actuator issues will happen after I am able to compile and start executing the code 😀 .

In any case, I am using Actuonix P16-100-22-12-R linear actuator. The data sheet is available at:

> **[ActuonixP16Datasheet.pdf](https://www.actuonix.com/assets/images/datasheets/ActuonixP16Datasheet.pdf)**
>
> 400.96 KB

Thanks again for your response.

---

<div class="post-metadata">

**Author:** ![mohan\_us](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mohan_us/32/1126558_2.png) [@mohan\_us](https://forum.arduino.cc/u/mohan_us)\
**Post date:** [February 15, 2026, 4:28pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/5 "2026-02-15T16:28:17Z")

</div>

Thanks for your reply.

I need to set custom min and max limits and the control signal period. These functions are not available in standard servo library as per the examples I read.

According to Arduino Uno R4 WiFi datasheet, ESP32-S3 is available as a co-processor, and the example usecases refer to including ESP32Servo.h in code.

---

<div class="post-metadata">

**Author:** ![kmin](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kmin/32/1147370_2.png) [@kmin](https://forum.arduino.cc/u/kmin)\
**Post date:** [February 15, 2026, 4:39pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/6 "2026-02-15T16:39:01Z")

</div>

Servo.h supports custom min/max.  
servo.attach(pin, minPulse, maxPulse);  
Do you really need custom signal period, if yes, what?

---

<div class="post-metadata">

**Author:** ![mohan\_us](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mohan_us/32/1126558_2.png) [@mohan\_us](https://forum.arduino.cc/u/mohan_us)\
**Post date:** [February 15, 2026, 4:54pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/7 "2026-02-15T16:54:17Z")

</div>

Yes. This is for a undergrad project. The Actuonix P16R allows one to vary the control signal frequency from 50–300Hz to reduce jitter. My understanding is one can use setPeriodHertz() function in ESP32Servo library for this purpose. I intended to use frequency of 250Hz (equivalent 4000 microsecond period).

---

<div class="post-metadata">

**Author:** ![van\_der\_decken](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/van_der_decken/32/1006976_2.png) [@van\_der\_decken](https://forum.arduino.cc/u/van_der_decken)\
**Post date:** [February 15, 2026, 5:01pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/8 "2026-02-15T17:01:39Z")

</div>

Your sketch runs on the RA4M1, not the ESP32. @kmin gave you the answer in [post #2](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/2).

---

<div class="post-metadata">

**Author:** ![mohan\_us](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mohan_us/32/1126558_2.png) [@mohan\_us](https://forum.arduino.cc/u/mohan_us)\
**Post date:** [February 15, 2026, 5:09pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/9 "2026-02-15T17:09:21Z")

</div>

Thanks for your reply. Being new to this, I don’t understand why all the servo examples for R4 mention this capability! Now the real question is, if I do need the functionality to control frequency of the control signal along with setting minimum and maximum pulse width at varius duty cycles, what is the right solution. Any help/recommendations are greatly appreciated.

---

<div class="post-metadata">

**Author:** ![kmin](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kmin/32/1147370_2.png) [@kmin](https://forum.arduino.cc/u/kmin)\
**Post date:** [February 15, 2026, 5:09pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/10 "2026-02-15T17:09:42Z")

</div>

> [@mohan\_us](#):
>
> from 50–300Hz

So it should work then with servo.h  
I already answered how to control min/max pulses.

---

<div class="post-metadata">

**Author:** ![david\_2018](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/david_2018/32/1013044_2.png) [@david\_2018](https://forum.arduino.cc/u/david_2018)\
**Post date:** [February 15, 2026, 5:12pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/11 "2026-02-15T17:12:15Z")

</div>

You would be better off using an ESP32 based board instead of trying to use the ESP32 on the UNO R4 WiFi.

---

<div class="post-metadata">

**Author:** ![mohan\_us](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mohan_us/32/1126558_2.png) [@mohan\_us](https://forum.arduino.cc/u/mohan_us)\
**Post date:** [February 15, 2026, 5:12pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/12 "2026-02-15T17:12:37Z")

</div>

Thanks. As far as I can tell, it does not have setPeriodHertz() functionality. I justed checked the docs again.

---

<div class="post-metadata">

**Author:** ![mohan\_us](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mohan_us/32/1126558_2.png) [@mohan\_us](https://forum.arduino.cc/u/mohan_us)\
**Post date:** [February 15, 2026, 5:14pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/13 "2026-02-15T17:14:50Z")

</div>

Thanks. Back to the drawing board 😢

---

<div class="post-metadata">

**Author:** ![kmin](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kmin/32/1147370_2.png) [@kmin](https://forum.arduino.cc/u/kmin)\
**Post date:** [February 15, 2026, 5:16pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/14 "2026-02-15T17:16:50Z")

</div>

It's fixed 50Hz but it has min/max pulse widths, all your actuator needs, so give it a try.

---

<div class="post-metadata">

**Author:** ![van\_der\_decken](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/van_der_decken/32/1006976_2.png) [@van\_der\_decken](https://forum.arduino.cc/u/van_der_decken)\
**Post date:** [February 15, 2026, 5:19pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/15 "2026-02-15T17:19:32Z")

</div>

It's literally a one line change in the library to change the frequency. A few more lines if you want to add a function to make it programmable at runtime.

---

<div class="post-metadata">

**Author:** ![mohan\_us](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mohan_us/32/1126558_2.png) [@mohan\_us](https://forum.arduino.cc/u/mohan_us)\
**Post date:** [February 15, 2026, 6:35pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/16 "2026-02-15T18:35:38Z")

</div>

> [@van\_der\_decken](#):
>
> RA4M1

Thanks. I did lost of experimentation with min and max already using the standard servo library. It did not meet the requirements - this is why I researched and tried to use the esp32 library. In any case, it looks like that is not a meaningful route either. Thanks again.

---

<div class="post-metadata">

**Author:** ![mohan\_us](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mohan_us/32/1126558_2.png) [@mohan\_us](https://forum.arduino.cc/u/mohan_us)\
**Post date:** [February 15, 2026, 6:36pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/17 "2026-02-15T18:36:12Z")

</div>

Thank you for your extremely helpful reply.

---

<div class="post-metadata">

**Author:** ![mohan\_us](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mohan_us/32/1126558_2.png) [@mohan\_us](https://forum.arduino.cc/u/mohan_us)\
**Post date:** [February 15, 2026, 6:41pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/18 "2026-02-15T18:41:49Z")

</div>

Thanks you all for your replies.

I found an example of changing the control signal frequency using the Arduino Uno R4 (RA4M1 chip) with the built-in PwmOut class that allows you to specify a custom period or frequency. I will try it out and if it works, I will report back.

---

<div class="post-metadata">

**Author:** ![kmin](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kmin/32/1147370_2.png) [@kmin](https://forum.arduino.cc/u/kmin)\
**Post date:** [February 15, 2026, 7:09pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/19 "2026-02-15T19:09:58Z")

</div>

> [@mohan\_us](#):
>
> I did lost of experimentation with min and max already using the standard servo library. It did not meet the requirements

Only you know these "requirements".  
According to the specs you linked, hard to believe it wouldn't run with standard servo.h.  
With insufficient power supply different story though...

---

<div class="post-metadata">

**Author:** ![mohan\_us](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mohan_us/32/1126558_2.png) [@mohan\_us](https://forum.arduino.cc/u/mohan_us)\
**Post date:** [February 15, 2026, 7:38pm UTC](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946/20 "2026-02-15T19:38:35Z")

</div>

Thanks. I did not want to complicate the thread by providing details that were not relevant to my basic issue of compiling an example sketch. However, since you asked, here is the basic (again, very simplistic) description.

The experiment is about constructing a small scale wave tank to study effects of architectural choices in mitigating damage from waves in coastal areas. The tank has to simulate waves moving at, at least, 3 different speeds (slow, medium, fast) and, for each speed, 3 different amplitudes (low, normal, and high). Pretty much all parts are ready except for the actual instrumentation. The P16R, a linear actuator (with external 12V 1A power supply), drives a paddle to generate waves. The paddle stroke size (sweep angle) controls amplitude of the generated waves. How fast a wave moves is controlled by instrumenting 3 different duty cycles (10, 15, and 20%) with peak voltage fixed at 12V. From my novice understanding of how servos work, I can effect the duty cycles by controlling the pulse width. For example, at fixed control frequency of 250Hz, desired pulse widths are 400 (10%), 600 (15%), and 800 (20%) microseconds.

Hopefully, it makes sense now. It is my mistake. I thought these details were irrelevant to the basic problem. I am sorry.

[Next page](https://forum.arduino.cc/t/compile-error-when-trying-to-use-esp32servo-library-for-uno-r4-wifi/1430946.md?page=2)
