
Generate sine wave, using analog output
Revision 2:e723d10f745d, committed 2014-02-12
- Comitter:
- aaronice
- Date:
- Wed Feb 12 18:58:54 2014 +0000
- Parent:
- 1:6b531bf059e4
- Child:
- 3:be30774cb93f
- Commit message:
- Variable Delta Time when Using Zero Order Hold
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Feb 10 18:53:59 2014 +0000 +++ b/main.cpp Wed Feb 12 18:58:54 2014 +0000 @@ -9,7 +9,7 @@ float Amp = 1.0; float w = 1.0; float pi = 3.14159; - + float deltaT = 0.01 void callback() { // Note: you need to actually read from the serial to clear the RX interrupt //int AA; @@ -23,7 +23,7 @@ pc.printf("Input parameter w and press Enter:\n"); pc.scanf("%f", &w); pc.printf("%f\n", w); - pc.printf("Continue...\n"); + pc.printf("Continuing...\n"); //w = (float)ww; } @@ -37,8 +37,8 @@ for (float i=0; i<(360); i++) { da = Amp*(sin(w*i/(180)*pi)*0.5+0.5); DA.write(da); - wait(0.01); - //pc.printf("%f ",da); + wait(deltaT) + pc.printf("%f ",da); //Monitor Received Analog In //pc.printf("%f ", AD.read());