Skip to main content
Associate III
January 15, 2024
Question

Controlling LED brightness using PWM frequnecy.

  • January 15, 2024
  • 2 replies
  • 1888 views

Hii,

i am using stm32 G0B1RE Board and i want to control brightness of LED connected on PC8 using PWM frequency generated on PA15 pin. i dont know how to do it. as i am new to using stm32.

This topic has been closed for replies.

2 replies

AScha.3
Super User
January 15, 2024

Hi,

You have many timer - so why not just use a timer at the pin you want to switch ?

PC8 should be possible , to use : (from ds) 

AScha3_0-1705330949493.png

 

If you feel a post has answered your question, please click on " Best Answer ".
ST Employee
January 15, 2024

Hello @Rohit007

You can either connect your LED to a GPIO with a timer directly or simply wire the output of the PWM signal to the LED. The duty cycle of the PWM signal will determine the brightness of the LED 

For the code of PWM generation, you can refer to the existing examples in STM32CubeG0 FW by following this link 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.