Rob Toulson / Mbed 2 deprecated PE_04-02_SawtoothWave

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*Program Example 4.2: Sawtooth waveform on DAC output. View on oscilloscope
00002                                                                               */
00003 #include "mbed.h"
00004 AnalogOut Aout(p18);
00005 float i;
00006 
00007 int main()
00008 {
00009     while(1) {
00010         for (i=0; i<1; i=i+0.1) {    // i is incremented in steps of 0.1
00011             Aout=i;
00012             wait(0.001);               // wait 1 millisecond
00013         }
00014     }
00015 }