JIAWEI ZHANG / Mbed 2 deprecated ele350ku

Dependencies:   mbed

Dependents:   Exercise8_1-2-3

Fork of ele350 by JIAWEI ZHANG

sine_app.cpp

Committer:
GGHHHH
Date:
2015-12-16
Revision:
29:8ec9451b1a59
Child:
32:b28a049ebbf1

File content as of revision 29:8ec9451b1a59:

#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();
}