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%
}
}