using resistor and DAC0_OUT to create a sawtooth wave

Revision:
1:a14b50308ca9
Parent:
0:f31836d48420
--- a/main.cpp	Sun Mar 29 19:41:28 2020 +0000
+++ b/main.cpp	Wed Apr 15 07:33:40 2020 +0000
@@ -1,18 +1,19 @@
 #include "mbed.h"
 
-// https://os.mbed.com/docs/mbed-os/v5.15/tools/creating-a-new-program.html
-
-Serial pc(USBTX, USBRX, 115200);    // baud rate 115200
-DigitalOut led(LED1);               // led = LED1
+AnalogOut vout(DAC0_OUT);  //vout = DAC0_OUT
 
 int main()
 {
+    float f;
+    int t = 0, i;
+
+    printf("Time, Vout\r\n");
     while (true) {
-        led = 0;
-        printf("LED1 is ON\r\n");
-        thread_sleep_for(500);
-        led = 1;
-        printf("LED1 is OFF\r\n");
-        thread_sleep_for(500);
+        for(f = 0.0; f < 1.1; f += 0.1) {
+            vout = f;
+            for(i = 0; i < 10; i++)
+                printf("%d, %f\r\n", t++, f*3.3); //vout = f * 3.3
+        }
+
     }
 }
\ No newline at end of file