Rob Toulson / Mbed 2 deprecated PE_04-01_DACOutput

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*Program Example 4.1: Three values of DAC are output in turn on Pin 18. Read the output on a DVM.
00002                                                                               */
00003 #include "mbed.h"
00004 AnalogOut Aout(p18);   //create an analog output on pin 18
00005 int main()
00006 {
00007     while(1) {
00008         Aout=0.25;           // 0.25*3.3V = 0.825V
00009         wait(2);
00010         Aout=0.5;            // 0.5*3.3V = 1.65V
00011         wait(2);
00012         Aout=0.75;           // 0.75*3.3V = 2.475V
00013         wait(2);
00014     }
00015 }