An example program driving the AnalogOut. Connect a pair of earphones!
Dependencies: mbed
Fork of app-board-AnalogOut by
main.cpp@0:1a38bf78f122, 2012-10-16 (annotated)
- Committer:
- chris
- Date:
- Tue Oct 16 13:40:24 2012 +0000
- Revision:
- 0:1a38bf78f122
- Child:
- 1:754db1ff50f2
First commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:1a38bf78f122 | 1 | #include "mbed.h" |
chris | 0:1a38bf78f122 | 2 | |
chris | 0:1a38bf78f122 | 3 | AnalogOut Aout(p18); |
chris | 0:1a38bf78f122 | 4 | AnalogIn pot1(p20); |
chris | 0:1a38bf78f122 | 5 | |
chris | 0:1a38bf78f122 | 6 | int main() |
chris | 0:1a38bf78f122 | 7 | { |
chris | 0:1a38bf78f122 | 8 | while(1) { |
chris | 0:1a38bf78f122 | 9 | for(float i=0.0; i<1.0; i+=0.1) { |
chris | 0:1a38bf78f122 | 10 | Aout = i; |
chris | 0:1a38bf78f122 | 11 | wait(0.00001+(0.0001*pot1.read())); |
chris | 0:1a38bf78f122 | 12 | } |
chris | 0:1a38bf78f122 | 13 | } |
chris | 0:1a38bf78f122 | 14 | } |