Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 3 months ago.
PWM Library and include a library
Hey guys,
i am a beginner in the STM32 World. At the moment i am using the online STM32 Editor and i found a FastPWM library by Erik Olieman which i tried to use. But it didn't work. I Used the following source code
#include "mbed.h"
#include "FastPWM.h"
PwmOut mypwm(PWM_OUT);
DigitalOut myled(LED1);
int main() {
mypwm.period_ms(10);
mypwm.pulsewidth_ms(1);
printf("pwm set to %.2f %%\n", mypwm.read() * 100);
while(1) {
myled = !myled;
wait(1);
}
}
and it produces the following error message "Error: Expression must have (pointer-to-) function type in "FastPWM/FastPWM_common.cpp", Line: 6, Col: 6"
in the manuial is written that i have to define the prescaler e.g. with -1. but it didn't work as well.
So can you tell me how i can fix this problem?
On the other hand does anybody have a fastPWM library with which it is possible to generate a PWM above 1 MHz?
I am using the Nucleo F411Re board.
thank you very much!
Replied in your duplicate forum topic :)
posted by Erik - 03 Sep 2015