A simple 1 kHz PWM signal generator with adjustable duty cycle over potentiometer.
Dependencies: mbed
Revision 0:61ad02148730, committed 2014-12-18
- Comitter:
- tbjazic
- Date:
- Thu Dec 18 12:18:08 2014 +0000
- Commit message:
- Initial commit.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Dec 18 12:18:08 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file