mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
a67d5d89e0
Command run was: git ls-tree -r HEAD --name-only | xargs dos2unix |
||
---|---|---|
.. | ||
main | ||
Makefile | ||
README.md |
LEDC (LED PWM Controller) Example
This example shows how to control intensity of LEDs using ESP32's on-board hardware LED PWM Controller module.
Functionality
Operations performed by example:
-
Configuration of two timers (one high speed and the other low speed) that will be clocking four LEDC channels.
-
Configuration of four channels of LEDC module, two channels will operate in high speed mode and two in low speed mode. Each channel will drive one GPIO / LED.
-
Initialization of fade service to fade / gradually change intensity of LEDs.
-
Operation of channels in a loop by cycling through four steps that will drive LEDs as follows:
- Fade up / increase intensity
- Fade down / decrease intensity (down to zero)
- Set steady intensity
- Set intensity to zero
Hardware Setup
Connect four LEDs to the following LEDC channels / individual GPIOs:
- Channel 0 - GPIO18
- Channel 1 - GPIO19
- Channel 2 - GPIO4
- Channel 3 - GPIO5