This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Frequency at 2 MHz

Hi.

In my program I need a frequency at 2 MHz (a square wave with duty cycle at 50%), it should just run a frequency in a short time, under one second. Also the code must listen to a voltage coming from a sensor.

Can someone help me with at least the frequency of 2MHz?

(I use nRF51822 mbed KIT)

I get below 9 kHz with the program I have now:

include "mbed.h"

PwmOut pwm(p22);

int main() { pwm.period(1.0/2000000.0); //T = 1/2MHz

    while(1) {
        pwm = 0.5; // Duty 50%
    }

}

Related