Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
gbeardall
Date:
Mon Oct 31 17:36:23 2011 +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
diff -r 000000000000 -r 12678c3187de main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Oct 31 17:36:23 2011 +0000
@@ -0,0 +1,52 @@
+/*
+ * wave2
+ *
+ */
+ 
+#include "mbed.h"
+
+DigitalOut myled(LED1);
+AnalogOut ano1(p18);
+
+Ticker oscTick1;
+
+float oscData[] = 
+//    { 0,1,0,1,0,1 };
+//    { 0, .5 };
+//    { .33,.67,.33,.67,.33,.67 };
+//    { 0, .15, .05, .1 }; // 1:1
+    { 0, .15, 0, .15, .05, .1, .05, .1, };
+//    { 
+//        0, .15, 0, .15, 0, .15, 0, .15, 0, .15, 0, .15, // 0, .15, 0, .15, 0, .15, 0, .15, 0, .15, 0, .15,
+//        .05, .1, .05, .1, .05, .1, .05, .1, .05, .1, .05, .1, // .05, .1, .05, .1, .05, .1, .05, .1, .05, .1, .05, .1,
+//      };
+
+const int dx_max = sizeof(oscData)/sizeof(oscData[0]);
+int dx = 0;
+
+// ---------------------------------------------------------------------------
+
+void oscOut1() {
+//    uint16_t v = (oscData[dx++]*0xFFFF)/3;
+    float v = oscData[dx++];
+//    ano1.write_u16(v);
+    ano1 = v;
+    if(dx >= dx_max) dx = 0; 
+}
+
+// ---------------------------------------------------------------------------
+
+int main() {
+
+    ano1 = 0;
+    oscTick1.attach_us(&oscOut1, 500); // chip period: 500-1KHz, 417-1200Hz, 833-600Hz
+
+    while(1) {
+        myled = 1;
+        wait(0.2);
+        myled = 0;
+        wait(0.2);
+    }
+
+} // main
+
diff -r 000000000000 -r 12678c3187de mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Oct 31 17:36:23 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912