esp-idf/examples/peripherals/ledc
krzychb d60722c33d Updated example and descritpion of LED PWM Controller API 2017-10-06 08:34:27 +02:00
..
main Updated example and descritpion of LED PWM Controller API 2017-10-06 08:34:27 +02:00
Makefile Moved examples to new folders / categories. Removed example numbers from example names 2017-01-16 23:08:35 +01:00
README.md Updated example and descritpion of LED PWM Controller API 2017-10-06 08:34:27 +02:00

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:

    1. Fade up / increase intensity
    2. Fade down / decrease intensity (down to zero)
    3. Set steady intensity
    4. 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