A sawtooth waveform generator using analog output, with smoothness setting over potentiometer.

Dependencies:   mbed

Revision:
0:0713d899de2b
Child:
1:91e1f50eac98
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Dec 17 16:35:37 2014 +0000
@@ -0,0 +1,15 @@
+#include "mbed.h"
+
+AnalogOut out(p18);
+AnalogIn pot1(p19);
+
+int main() {
+    int numberOfPoints;
+    while(1) {
+        numberOfPoints = 10 + pot1 * 90; // 10 to 100 points
+        for (int i = 0; i < numberOfPoints; i++) {
+            out = i / numberOfPoints;
+            wait_us(10000/numberOfPoints);
+        }
+    }
+}
\ No newline at end of file