Generate a 5kHz Saw Tooth wave, with 10 steps per cycle

Dependencies:   mbed

Dependents:   CPP

Files at this revision

API Documentation at this revision

Comitter:
chris
Date:
Mon Sep 13 14:05:22 2010 +0000
Commit message:

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	Mon Sep 13 14:05:22 2010 +0000
@@ -0,0 +1,12 @@
+#include "mbed.h"
+
+AnalogOut speaker(p18);
+
+int main() {
+    while (1) {
+        for (float i = 0.0 ; i <= 1.0 ; i += 0.1 ) {
+            speaker = i;
+            wait (0.00001); // 5kHz, with 10 steps
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Sep 13 14:05:22 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e