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.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
I have written a simple PWM code which is reproduced below:
#include "mbed.h" AnalogIn ain(p20); PwmOut led(LED1); PwmOut pin(p21); int main() { while(1){ float varf = ain.read(); if(varf <= 0.1) { led = 0.1; pin = 0.1; } else { led = varf; pin = varf; } wait_ms(0.005); } } //mainI am hoping that the wait_ms() as set above should give me a frequncy of 200KHz on pin 21. But no matter what I set this value I always get 50Hz. As I vary the voltage on pin 20 which is the analog in, the pulse width is varying correctly but not the frequency. I would appreciate if someone can shed some light on this. Thanks