JIAWEI ZHANG / Mbed 2 deprecated ele350ku

Dependencies:   mbed

Dependents:   Exercise8_1-2-3

Fork of ele350 by JIAWEI ZHANG

Revision:
29:8ec9451b1a59
Child:
32:b28a049ebbf1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sine_app.cpp	Wed Dec 16 06:59:42 2015 +0000
@@ -0,0 +1,29 @@
+#include "sine_app.h"
+
+SineApp::SineApp(Serial* serial) : App("Sine wave", serial) {
+    this->analogOut = new AnalogOut (PA_4);
+}
+
+void SineApp::start()
+{
+    App::start();
+    this->analogOut->write(0);
+    this->timer.start(); 
+
+}
+
+void SineApp::run()
+{
+   this->analogOut->write(1000* this->timer.read());
+   
+   if (this->timer.read()>0.001f){
+       this->timer.reset();}
+}
+
+void SineApp::stop()
+{
+    App::stop();
+    this->analogOut->write(0);
+    this->timer.stop();
+    this->timer.reset();
+}
\ No newline at end of file