A simple sawtooth waveform generator using analog output.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
tbjazic
Date:
Thu Dec 18 07:34:06 2014 +0000
Parent:
0:95fd5a7168ac
Commit message:
Cast operator (float) added for accurate float division.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 95fd5a7168ac -r 8901d4a806a8 main.cpp
--- a/main.cpp	Wed Dec 17 16:19:30 2014 +0000
+++ b/main.cpp	Thu Dec 18 07:34:06 2014 +0000
@@ -5,7 +5,7 @@
 int main() {
     while(1) {
         for (int i = 0; i < 10; i++) {
-            out = i / 10;
+            out = (float) i / 10;
             wait_ms(1);
         }
     }