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
--- a/square_app.cpp	Thu Dec 17 16:15:42 2015 +0000
+++ b/square_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);}
 
 }
 
@@ -26,11 +31,6 @@
    if ( frequence > 50.0f ) {
        this->analogOut->write(0);
     } else { this->analogOut->write(this->amplitude/2.95f);}
-    float amplitude;
-    amplitude = 2.95;
-    if ( amplitude > 2.95f ) {
-       this->analogOut->write(0);
-    } else { this->analogOut->write(this->amplitude/2.95f);}
 }
 
 void SquareApp::stop()