Skip to content

Conversation

markub3327
Copy link
Contributor

Hi @per1234, @facchinm, @aentinger

this PR adds the support for Arduino Nano ESP32 board.

Description

This pull request adds support for the Arduino Nano ESP32 board to the Servo library. The following enhancements and changes have been made:

  • Implemented platform-specific code to ensure compatibility with the ESP32 architecture, focusing on the Arduino Nano ESP32 variant.
  • Added conditional compilation and relevant macros to maintain backward compatibility with other supported platforms.

Motivation and Context

The Arduino Nano ESP32 is a popular and powerful board in the Arduino ecosystem. Adding support for this board allows users to control servo motors using the familiar Servo library APIs, expanding the library’s versatility and making it accessible to a wider audience.

Testing

  • Tested on Arduino Nano ESP32 with various standard servos.
  • Verified that existing functionality for other platforms (e.g., AVR, ARM) remains unaffected.
  • Ran all example sketches on supported platforms by GitHub Actions.

Thank you for the time you are giving to this PR.

Enables the Servo library to be used with Arduino Nano ESP32 board.
@CLAassistant
Copy link

CLAassistant commented Jul 9, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

github-actions bot commented Jul 9, 2025

Memory usage change @ c26437f

Board flash % RAM for global variables %
arduino:avr:leonardo 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:avr:mega 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:avr:nano 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:esp32:nano_nora N/A N/A N/A N/A
arduino:mbed_nano:nano33ble 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_nano:nanorp2040connect 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
arduino:mbed_portenta:envie_m7:target_core=cm4 N/A N/A N/A N/A
arduino:megaavr:nona4809 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:sam:arduino_due_x_dbg 0 - 0 0.0 - 0.0 N/A N/A
arduino:samd:mkrzero 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table
Board examples/Knob
flash
% examples/Knob
RAM for global variables
% examples/Sweep
flash
% examples/Sweep
RAM for global variables
%
arduino:avr:leonardo 0 0.0 0 0.0 0 0.0 0 0.0
arduino:avr:mega 0 0.0 0 0.0 0 0.0 0 0.0
arduino:avr:nano 0 0.0 0 0.0 0 0.0 0 0.0
arduino:esp32:nano_nora N/A N/A N/A N/A N/A N/A N/A N/A
arduino:mbed_nano:nano33ble 0 0.0 0 0.0 0 0.0 0 0.0
arduino:mbed_nano:nanorp2040connect 0 0.0 0 0.0 0 0.0 0 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A N/A N/A N/A N/A
arduino:mbed_portenta:envie_m7:target_core=cm4 N/A N/A N/A N/A N/A N/A N/A N/A
arduino:megaavr:nona4809 0 0.0 0 0.0 0 0.0 0 0.0
arduino:sam:arduino_due_x_dbg 0 0.0 N/A N/A 0 0.0 N/A N/A
arduino:samd:mkrzero 0 0.0 0 0.0 0 0.0 0 0.0
Click for full report CSV
Board,examples/Knob<br>flash,%,examples/Knob<br>RAM for global variables,%,examples/Sweep<br>flash,%,examples/Sweep<br>RAM for global variables,%
arduino:avr:leonardo,0,0.0,0,0.0,0,0.0,0,0.0
arduino:avr:mega,0,0.0,0,0.0,0,0.0,0,0.0
arduino:avr:nano,0,0.0,0,0.0,0,0.0,0,0.0
arduino:esp32:nano_nora,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A
arduino:mbed_nano:nano33ble,0,0.0,0,0.0,0,0.0,0,0.0
arduino:mbed_nano:nanorp2040connect,0,0.0,0,0.0,0,0.0,0,0.0
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A
arduino:mbed_portenta:envie_m7:target_core=cm4,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A
arduino:megaavr:nona4809,0,0.0,0,0.0,0,0.0,0,0.0
arduino:sam:arduino_due_x_dbg,0,0.0,N/A,N/A,0,0.0,N/A,N/A
arduino:samd:mkrzero,0,0.0,0,0.0,0,0.0,0,0.0

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Jul 9, 2025
@aentinger
Copy link
Contributor

Ciao @markub3327 ☕ 👋

I no longer work for Arduino and gone is my commit access 😉

@markub3327
Copy link
Contributor Author

@aentinger Thank you for information.

@zachwelch
Copy link

Thank you for this PR! I managed to get this working on a Seeed Studio XIAO ESP32S3 board, but it required some minor modifications to chase changes in the ledc APIs made between ESP-IDF v4.x and v5.x. Happily, my changes should allow this library to work with both v4.x and v5.x.

I have pushed my changes to the ztw/esp32 branch in my fork: https://github.com/zachwelch/Servo/tree/ztw/esp32
@markub3327 If you have time, please test my changes and, if they still work on 4.x (and otherwise meet with your approval), feel free to stack them on top of your branch here.

@facchinm facchinm requested a review from gbr1 August 4, 2025 07:39
Copy link
Contributor

@gbr1 gbr1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I tested on my Nano ESP32 with a MF90 servo

@markub3327 markub3327 closed this Aug 4, 2025
@markub3327 markub3327 reopened this Aug 4, 2025
@markub3327
Copy link
Contributor Author

@gbr1. Thank you for testing I apply this changes

@gbr1 gbr1 merged commit 2832d5c into arduino-libraries:master Aug 4, 2025
27 checks passed
@markub3327 markub3327 deleted the esp32 branch August 4, 2025 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants