JIAWEI ZHANG / Mbed 2 deprecated ele350ku

Dependencies:   mbed

Dependents:   Exercise8_1-2-3

Fork of ele350 by JIAWEI ZHANG

Revision:
41:db959505e044
Parent:
39:ab2557044815
Child:
42:6eb557ade29c
diff -r ca1789c40924 -r db959505e044 sine_app.cpp
--- a/sine_app.cpp	Thu Dec 17 14:21:26 2015 +0000
+++ b/sine_app.cpp	Thu Dec 17 14:38:22 2015 +0000
@@ -3,7 +3,7 @@
 SineApp::SineApp(Serial* serial) : App("Sine wave", serial) {
     this->analogOut = new AnalogOut (PA_4);
     this->amplitude = 3.0f;
-    this->frequence = 20.0f;
+    this->frequence = 50.0f;
 }
 
 void SineApp::start()
@@ -16,7 +16,7 @@
 
 void SineApp::run()
 {
-   this->analogOut->write(this->amplitude/3.0*0.5*(1+sin(frequence*3.14159*2*timer.read())));
+   this->analogOut->write(this->amplitude/3.0f*0.5f*(1.0f+sin(frequence*6.28f*timer.read())));
    
 
 }