JIAWEI ZHANG / Mbed 2 deprecated ele350ku

Dependencies:   mbed

Dependents:   Exercise8_1-2-3

Fork of ele350 by JIAWEI ZHANG

Revision:
43:b45ede0e3ba6
Parent:
42:6eb557ade29c
Child:
46:efa9285bf105
diff -r 6eb557ade29c -r b45ede0e3ba6 sine_app.cpp
--- a/sine_app.cpp	Thu Dec 17 16:15:42 2015 +0000
+++ b/sine_app.cpp	Thu Dec 17 16:22:03 2015 +0000
@@ -11,6 +11,11 @@
     App::start();
     this->analogOut->write(this->amplitude/2.95f);
     this->timer.start(); 
+    float amplitude;
+    amplitude = 2.95;
+    if ( amplitude > 2.95f ) {
+       this->analogOut->write(0);
+    } else { this->analogOut->write(this->amplitude/2.95f);}
 
 }
 
@@ -22,11 +27,6 @@
    if ( frequence > 50.0f ) {
        this->analogOut->write(0);
     } else { this->analogOut->write(this->amplitude/3.0f*0.5f*(1.0f+sin(frequence*6.28f*timer.read())));}
-    float amplitude;
-    amplitude = 2.95;
-    if ( amplitude > 2.95f ) {
-       this->analogOut->write(0);
-    } else { this->analogOut->write(this->amplitude/2.95f);}
    
 
 }