ESP32 LEDC Output

The LEDC output component exposes a LEDC PWM channel of the ESP32 as an output component.

The frequency range of LEDC is from 10Hz to 40MHz - however, higher frequencies require a smaller bit_depth which means the output is not that accurate for frequencies above ~300kHz.

# Example configuration entry
  - platform: ledc
    pin: GPIO19
    id: gpio_19

# Example usage in a light
  - platform: monochromatic
    output: gpio_19
    name: "Kitchen Light"

Configuration variables:

  • pin (Required, Pin): The pin to use LEDC on. Can only be GPIO0-GPIO33.
  • id (Required, ID): The id to use for this output component.
  • frequency (Optional, float): At which frequency to run the LEDC channel’s timer. Defaults to 1000Hz.
  • bit_depth (Optional, int): The bit depth to use for the LEDC channel. Defaults to the highest possible for the configured frequency.
  • All other options from Output.

Advanced options:

  • channel (Optional, int): Manually set the LEDC channel to use. Two adjacent channels share the same timer. Defaults to an automatic selection.