JIAWEI ZHANG / Mbed 2 deprecated ele350ku

Dependencies:   mbed

Dependents:   Exercise8_1-2-3

Fork of ele350 by JIAWEI ZHANG

constant_app.cpp

Committer:
GGHHHH
Date:
2015-12-16
Revision:
30:93b353d3b680
Parent:
29:8ec9451b1a59
Child:
31:6f781b2ebde6

File content as of revision 30:93b353d3b680:

#include "constant_app.h"

ConstantApp::ConstantApp(Serial* serial) : App("Constant Voltage", serial) {
    this->analogOut = new AnalogOut (PA_4);
}

void ConstantApp::start()
{
    App::start();
    this->analogOut->write(0);
    this->timer.start(); 

}

void ConstantApp::run()
{
   this->analogOut->write(1000* this->timer.read());
   
   if (this->timer.read()>2.0f){
       this->timer.reset();}
}

void ConstantApp::stop()
{
    App::stop();
    this->analogOut->write(0);
    this->timer.stop();
    this->timer.reset();
}