by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"

Dependencies:   mbed

Committer:
robt
Date:
Fri Aug 31 15:25:21 2012 +0000
Revision:
0:c6eda2b9bd63
by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"

Who changed what in which revision?

UserRevisionLine numberNew contents of line
robt 0:c6eda2b9bd63 1 /*Program Example 4.1: Three values of DAC are output in turn on Pin 18. Read the output on a DVM.
robt 0:c6eda2b9bd63 2 */
robt 0:c6eda2b9bd63 3 #include "mbed.h"
robt 0:c6eda2b9bd63 4 AnalogOut Aout(p18); //create an analog output on pin 18
robt 0:c6eda2b9bd63 5 int main()
robt 0:c6eda2b9bd63 6 {
robt 0:c6eda2b9bd63 7 while(1) {
robt 0:c6eda2b9bd63 8 Aout=0.25; // 0.25*3.3V = 0.825V
robt 0:c6eda2b9bd63 9 wait(2);
robt 0:c6eda2b9bd63 10 Aout=0.5; // 0.5*3.3V = 1.65V
robt 0:c6eda2b9bd63 11 wait(2);
robt 0:c6eda2b9bd63 12 Aout=0.75; // 0.75*3.3V = 2.475V
robt 0:c6eda2b9bd63 13 wait(2);
robt 0:c6eda2b9bd63 14 }
robt 0:c6eda2b9bd63 15 }