A simple 1 kHz PWM signal generator with adjustable duty cycle over potentiometer.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:61ad02148730
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Dec 18 12:18:08 2014 +0000 @@ -0,0 +1,11 @@ +#include "mbed.h" + +PwmOut pwm(p21); +AnalogIn pot1(p19); + +int main() { + pwm.period(0.001); // 1 kHz or 1 ms + while(1) { + pwm = pot1; + } +} \ No newline at end of file