cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Discovery Leds

anomyzer
Associate
Posted on September 03, 2015 at 18:50

Hi,

i am searching for a openscource code to dim and change the frequency the leds over a potentiometer on the stm32f4 discovery board. I researched on the net but did not find anything. Can somebody help me please.

Thank You !

3 REPLIES 3
Posted on September 03, 2015 at 19:13

Assume that everything isn't on the Internet, and sometimes you have to code things to do specifically what you want. The DISCO board doesn't have a pot on it, so it would be hard to assume what specific pin it might attach too.

This STM32F4-DISCO PWM Servo example outputs via the LEDs on TIM4, you could modify this to change the frequency, and duty of the signal driving the LEDs

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/%5bSTM32f4discovery%5dSome%20clarification%20about%20PWM&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F&...

You could add code to use the ADC to read the value from a POT, and translate that into settings for the PWMs

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
anomyzer
Associate
Posted on September 03, 2015 at 19:18

Hi,

thank you! I have two two extern pot over that i want to dimm the leds and change the frequency (adc..timer..?) 

can you help how i can modfie the code that or how to implent that?

would be great if you can help me.

thanks a lot!

Posted on September 04, 2015 at 19:26

Sounds very homeworky...

The are Standard Peripheral Library examples for the ADC within the F4 DSP and F4 DISCO firmware downloads.

The frequency can be changed via the TIM4->ARR register. The duty can be controlled via the TIM4->CCR1..4 registers.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..