using resistor and DAC0_OUT to create a sawtooth wave

main.cpp

Committer:
namcheol
Date:
2020-04-15
Revision:
1:a14b50308ca9
Parent:
0:f31836d48420

File content as of revision 1:a14b50308ca9:

#include "mbed.h"

AnalogOut vout(DAC0_OUT);  //vout = DAC0_OUT

int main()
{
    float f;
    int t = 0, i;

    printf("Time, Vout\r\n");
    while (true) {
        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
        }

    }
}