An example program driving the AnalogOut. Connect a pair of earphones!

Dependencies:   mbed

Fork of app-board-AnalogOut by Chris Styles

Committer:
AndyR
Date:
Mon May 05 14:53:03 2014 +0000
Revision:
2:1b650317539d
Parent:
1:754db1ff50f2
Test DAC;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chris 0:1a38bf78f122 1 #include "mbed.h"
chris 0:1a38bf78f122 2
chris 0:1a38bf78f122 3 AnalogOut Aout(p18);
AndyR 2:1b650317539d 4 //AnalogIn pot1(p19);
AndyR 2:1b650317539d 5 int i = 0;
chris 0:1a38bf78f122 6
chris 0:1a38bf78f122 7 int main()
chris 0:1a38bf78f122 8 {
chris 0:1a38bf78f122 9 while(1) {
AndyR 2:1b650317539d 10 // for(float i=0.0; i<1.0; i+=0.01) {
AndyR 2:1b650317539d 11
AndyR 2:1b650317539d 12 if(i==1)
AndyR 2:1b650317539d 13 {
AndyR 2:1b650317539d 14 i=0.0;
AndyR 2:1b650317539d 15 }
AndyR 2:1b650317539d 16 else i=1;
chris 0:1a38bf78f122 17 Aout = i;
AndyR 2:1b650317539d 18 wait(0.000001);
AndyR 2:1b650317539d 19
chris 0:1a38bf78f122 20 }
chris 0:1a38bf78f122 21 }