10 years, 4 months ago.

ST Nucleo F401RE PWM's support

How could i activate whole PWM outputs at the same time?

Question relating to:

ST
A world leader in providing the semiconductor solutions that make a positive contribution to people’s lives, both today and in the future.

Roon_van_Boh / Sergey Kordubin

Help

Please specify your question. Give an example of your code to 2 PWM outputs. We will think together with you how to do it. I think it would be useful to know for me.

Greetings from Russia.

Уточните пожалуйста ваш вопрос. Приведите пример вашего кода для 2 выходов ШИМ. Мы будем думать вместе с вами как это сделать. Я думаю что это будет полезно узнать для меня.

Привет из России.

???

main.cpp

#include "mbed.h"
 
PwmOut mypwm1(PWM_OUT_PIN_NAME);
PwmOut mypwm2(PWM_OUT_PIN_NAME);
PwmOut mypwm3(PWM_OUT_PIN_NAME);
 
DigitalOut myled(LED1);
 
int main() {
    
    mypwm.period_ms1(10);
    mypwm.pulsewidth_ms1(1);

    mypwm.period_ms2(20);
    mypwm.pulsewidth_ms2(2);

    mypwm.period_ms3(30);
    mypwm.pulsewidth_ms3(3);
  
    printf("pwm1 set to %.2f %%\n", mypwm1.read() * 100);
    printf("pwm2 set to %.2f %%\n", mypwm2.read() * 100);
    printf("pwm3 set to %.2f %%\n", mypwm3.read() * 100);
    
    while(1) {
        myled = !myled;
        wait(1);
    }
}

???

posted by Sergey Kordubin 10 Jul 2014
Be the first to answer this question.