Robert Abad / Mbed 2 deprecated Lab4_3

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
rabad1
Date:
Fri Oct 25 07:41:52 2013 +0000
Commit message:
sinusoid wave generator with input from pot

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	Fri Oct 25 07:41:52 2013 +0000
@@ -0,0 +1,26 @@
+#include "mbed.h"
+
+#define INPUT_SCALAR        (0.01f)
+
+AnalogIn Ain(p19);
+AnalogOut Aout(p18);
+float i;
+
+int main()
+{
+    while(1)  {
+        for (i=0; i<2; i=i+0.05) {
+            Aout=0.5+0.5*sin(i*3.14159);  // Compute the sine value, + half the range
+         
+            // Controls the sine wave period
+            // NOTE to my fellow students:
+            // in order to get to pot to work as an input to control the frequency,
+            // I've had to scale the setting of the pot.  However, I have not had
+            // enough scope time to play with the scalar value to fully understand
+            // the how the pot affects the frequency.  So I encourage you to play
+            // the scalar value to get it to work within the desired frequency range
+            wait(Ain*INPUT_SCALAR);
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Oct 25 07:41:52 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file