Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32_EasyKit: Advanced Servo, Motor, and LED Library

License: MIT

ESP32_EasyKit is a high-performance C++17 library for the ESP32 series that leverages native silicon features (MCPWM and LEDC) to provide rock-solid, hardware-locked control for robots, lighting, and RC applications.


Why use this library?

  • ⚡ Hardware-Locked Stability: Uses dedicated MCPWM units for sub-microsecond pulse precision with zero CPU jitter.
  • 🤖 Organic Motion: Advanced Asymmetric Sigmoid easing and Momentum Hand-off ensure professional, jerk-free movements for servos.
  • 🏎️ Low Latency: Direct-drive motor control with hardware-enforced dead-time for high-performance control loops.
  • 💎 FPU Optimized: Designed from the ground up for the ESP32 hardware Floating Point Unit.

Quick Example

#include <ESP32_EasyKit.h>

Servo myServo;
EasyMotor myMotor;
EasyLED myLED(6);

void setup() {
  myServo.attach(18);
  myMotor.begin(7, 8);

  // Asymmetric move: Go to 90°, rapid start, soft finish (0.2 in, 0.8 out)
  myServo.write(90.0f, 60.0f, 0.2f, 0.8f);

  // Instant motor control (Direct-Drive)
  myMotor.write(100.0f);
}

void loop() {
  myServo.update(); // Process servo animation
  myLED.update();   // Process LED fading/blinking
}

Documentation

For a deep dive into the library architecture and performance tuning, start with the General Guide.

API Reference

  • 📑 Servo Functions: Precise motion with asymmetric easing and multi-pin support.
  • 📑 Motor Functions: Low-latency direct-drive control.
  • 📑 LED & PWM Functions: Flicker-free transitions and patterns.
  • 📑 EasyLEDGroup: Coordinated multi-LED step sequencing (alternate, syncFlash, chase, doubleStrobe).

EasyLEDGroup Example

EasyLED ditchL(4), ditchR(5);
EasyLEDGroup ditchGroup({&ditchL, &ditchR});

void setup() {
  ditchGroup.alternate(16); // Alternate ditch lights every 16ms
}

void loop() {
  ditchGroup.update();
}

Performance Tip

To maximize performance, always use the f suffix for decimal constants:

myServo.write(90.0f, 60.0f, 0.5f, 0.5f); // Hardware FPU (Fast)
myServo.write(90.0, 60.0, 0.5, 0.5);     // Software Emulation (Slow)

For more details on forcing FPU safety with compiler flags, see the Optimization Guide.


Licensed under the MIT License.

About

Unified MCPWM + LEDC PWM library for ESP32 (Servo, DC Motor, LED Fade, LED Blink)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages