An example program driving the AnalogOut. Connect a pair of earphones!
Dependencies: mbed
Fork of app-board-AnalogOut by
Revision 2:1b650317539d, committed 2014-05-05
- Comitter:
- AndyR
- Date:
- Mon May 05 14:53:03 2014 +0000
- Parent:
- 1:754db1ff50f2
- Commit message:
- Test DAC;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 754db1ff50f2 -r 1b650317539d main.cpp --- a/main.cpp Tue Jun 18 11:15:37 2013 +0000 +++ b/main.cpp Mon May 05 14:53:03 2014 +0000 @@ -1,14 +1,21 @@ #include "mbed.h" AnalogOut Aout(p18); -AnalogIn pot1(p19); +//AnalogIn pot1(p19); +int i = 0; int main() { while(1) { - for(float i=0.0; i<1.0; i+=0.1) { + // for(float i=0.0; i<1.0; i+=0.01) { + + if(i==1) + { + i=0.0; + } + else i=1; Aout = i; - wait(0.00001+(0.0001*pot1.read())); - } + wait(0.000001); + } }