This application controls arbitrary frequency pulses with STM32 MCU. In this example, the frequency changes when a pushbutton switch is held down, but it can be applied in many other ways.
This program changes the blinking cycle of the timer output by increasing or decreasing the counter setting value when the pushbutton switch input is turned ON.
A 10 ms interrupt is generated by Systick and the counter set value (arr_val) is increased or decreased in the SysTick interrupt handler.
Pins used: PB８ Alternate output (Timer output)
PC13 Input (Pushbotton SW)
Peripheral used: TIM4_CH3 Count CLK1kHz
This application uses a combination of switch inputs and SysTick interrupts to increase or decrease values, but this is just one example of an application. Other possibilities include changing numerical values in response to input values from an analog VR, or increasing or decreasing numerical values via serial communication.