This example is an evolution of the: STM32 Basic Timer in Interrupt & PWM mode
In this example the duty cycle is regulated using a potentiometer.
See the diagram below.
All is developed using CUBE-MX and are generated for ATOLLIC.
Here there is the project for CUBE-MX, the project is generated for NUCLEO-F030R8.
For reading more, click here.