Hi guys,
Earlier I made one post regarding creation of square wave from PwmOut. Well I have created that square wave of 1kHz from 200 kHz. Below is the code:
#include "mbed.h"
PwmOut PwmPin (p22);
int main() {
PwmPin.period(0.000005); // Set frequency to 200,000 Hz (period = 5 us)
while(1){ //infinite loop
PwmPin.write(0); // Set the duty cycle to 0%
wait_us(500); // wait 100 PWM cyles
PwmPin.write(1); // Set the duty cycle to 100%
wait_us(500); // wait 100 PWM cycles
}
}
Now my question is that how can I get sine wave of same (1kHz frequency) from this.
I have tried to merge some extra code into it but when I checked it on oscilloscope, its still the square wave.
I got very limited time for this. Any help would be appreciable.
Hi guys, Earlier I made one post regarding creation of square wave from PwmOut. Well I have created that square wave of 1kHz from 200 kHz. Below is the code:
Now my question is that how can I get sine wave of same (1kHz frequency) from this.
I have tried to merge some extra code into it but when I checked it on oscilloscope, its still the square wave.
I got very limited time for this. Any help would be appreciable.