A simple 1 kHz PWM signal generator with 50% duty cycle.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
tbjazic
Date:
Thu Dec 18 11:59:40 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
diff -r 000000000000 -r 53a5be91e9dc main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Dec 18 11:59:40 2014 +0000
@@ -0,0 +1,10 @@
+#include "mbed.h"
+
+PwmOut pwm(p21);
+
+int main() {
+    pwm.period(0.001); // 1 kHz or 1 ms
+    while(1) {
+        pwm = 0.5;
+    }
+}
diff -r 000000000000 -r 53a5be91e9dc mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Dec 18 11:59:40 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5
\ No newline at end of file