Hi expert,
Wants understand how to generate a signal of 7000hz by the pwmout mbed's library,
I read a lot of explainations but i can't find a simple sample code with a good explaination.
Thanks
Hello!
PwmOut - Handbook | mbed should give you a few pointers:
#include "mbed.h" PwmOut led(LED2); int main() { // specify period first, then everything else led.period(0.00014285f); // 1.4285e-4 second period is 7kHz led.write(0.50f); // 50% duty cycle while(1); // led flashing }
Thanks for the code albanrampon but how did the fraction of second could be calculate ? i have some difficulty to understand this point
This function wants the period:
After all it isnt a big probleme to know
it, have the right tools to do it, is enough !
https://www.unitjuggler.com/convertir-frequency-de-Hz-en-s%28p%29.html?val=7000
Explained like this is very easy ! thank you