Dim the LED with PWM
Video lesson · in the full course
We run the chip at 84 MHz, connect TIM2 channel 1 to the LED pin PA5, and make a 1 kHz PWM signal. The loop raises the duty cycle step by step, so the LED fades in again and again.
What this lesson covers
- A new project at 84 MHz
- Set TIM2 to make a 1 kHz signal on the LED pin
- Start the PWM
- Change the duty cycle in the loop
By the end, the green LED fades from off to full brightness every half second, driven by a hardware timer.
The full course has the video, every step with screenshots, the code with a copy button, and the checks and fixes. $20 once unlocks this lesson, the other 7 full-course lessons and 36 bonus lessons, and you can ask me questions under each one. Checkout on steppeschool.com; 14-day money-back guarantee.