MCPcopy Create free account
hub / github.com/RoboticsBrno/ServoESP32

github.com/RoboticsBrno/ServoESP32 @v1.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1.1 ↗ · + Follow
18 symbols 21 edges 2 files 10 documented · 56% updated 2y agov1.1.1 · 2023-08-31★ 17416 open issues

Browse by type

Functions 16 Types & classes 2
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ServoESP32 Build Status

Generate RC servo signal on a selected pins with ESP32 device and Arduino framework.

Base on servo library for stm32f4 (d2a4a47).

Interface

The interface is similar to Arduino/Servo: https://www.arduino.cc/en/Reference/Servo

But the function attach() is different:

bool attach(
    int pin,
    int channel = CHANNEL_NOT_ATTACHED,
    int minAngle = DEFAULT_MIN_ANGLE,
    int maxAngle = DEFAULT_MAX_ANGLE,
    int minPulseWidthUs = DEFAULT_MIN_PULSE_WIDTH_US,
    int maxPulseWidthUs = DEFAULT_MAX_PULSE_WIDTH_US,
    int frequency = DEFAULT_FREQUENCY
);

More information in source code documentation.

Example: 04-SimpleServoAngles

There are also a ServoFloat and ServoDouble variant available. Use one of these when working in radians.

Example: : 05-SimpleServoRadians

IMPORTANT INFO

According testings, the frequency for ESP32 S2/S3/C3 has to be set at least to 200 Hz. Here is an example, how to set just frequency:

Servo servo1;
const int servoPin = 4;
const int frequency = 200; // Hz

servo1.attach(
    servoPin, 
    Servo::CHANNEL_NOT_ATTACHED, 
    Servo::DEFAULT_MIN_ANGLE, 
    Servo::DEFAULT_MAX_ANGLE, 
    Servo::DEFAULT_MIN_PULSE_WIDTH_US, 
    Servo::DEFAULT_MAX_PULSE_WIDTH_US, 
    frequency
);

For more information look at the PR25

PlatformIO

This library is also available at the PlatformIO as ServoESP32.

Arduino IDE

This library is available in Arduino IDE Library Manager as ServoESP32.

Known issues

Problem with build in Arduino IDE 1.8.10

There was an issue with building this library in Arduino IDE 1.8.10. But this issue should be fixed in Arduino IDE 1.8.11.

Core symbols most depended-on inside this repo

Shape

Method 16
Class 2

Languages

C++100%

Modules by API surface

src/Servo.h18 symbols

For agents

$ claude mcp add ServoESP32 \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page