In the steps of this tutorial
The basic of PWM are described on Wikipedia: https://en.wikipedia.org/wiki/Pulse-width_modulation
The Espressif ESP32C3 has a dedicated hardware module, which can generate PWM signals. The Espressif ESP32C3 PWM hardware module is called LED Control (LEDC) and described in the Espressif documentation: https://docs.espressif.com/projects/esp-idf/en/stable/esp32c3/api-reference/peripherals/ledc.html
The library to control the ESP32C3’s LED Control module is described in the Espressif’s GitHub repository: https://github.com/espressif/arduino-esp32/blob/master/docs/en/api/ledc.rst
Example code: pwm_ledc
Example code: pwm_ledc_2pins