MengLi Shih
/
2_3_Sine_Waveform
lab2_3
main.cpp@0:63e6f6d73244, 2017-02-26 (annotated)
- Committer:
- shih775007
- Date:
- Sun Feb 26 08:47:26 2017 +0000
- Revision:
- 0:63e6f6d73244
lab2_3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shih775007 | 0:63e6f6d73244 | 1 | #include "mbed.h" |
shih775007 | 0:63e6f6d73244 | 2 | |
shih775007 | 0:63e6f6d73244 | 3 | |
shih775007 | 0:63e6f6d73244 | 4 | |
shih775007 | 0:63e6f6d73244 | 5 | AnalogOut Aout(DAC0_OUT); |
shih775007 | 0:63e6f6d73244 | 6 | |
shih775007 | 0:63e6f6d73244 | 7 | |
shih775007 | 0:63e6f6d73244 | 8 | |
shih775007 | 0:63e6f6d73244 | 9 | int main(){ |
shih775007 | 0:63e6f6d73244 | 10 | float i; |
shih775007 | 0:63e6f6d73244 | 11 | while(1){ |
shih775007 | 0:63e6f6d73244 | 12 | for( i=0; i<2; i+=0.05 ){ |
shih775007 | 0:63e6f6d73244 | 13 | Aout = 0.5 + 0.5*sin(i*3.14159); |
shih775007 | 0:63e6f6d73244 | 14 | wait(0.001); |
shih775007 | 0:63e6f6d73244 | 15 | } |
shih775007 | 0:63e6f6d73244 | 16 | } |
shih775007 | 0:63e6f6d73244 | 17 | } |