Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of ele350 by
square_app.cpp
- Committer:
- GGHHHH
- Date:
- 2015-12-17
- Revision:
- 34:498a218cf53e
- Parent:
- 29:8ec9451b1a59
- Child:
- 35:6855566cc941
File content as of revision 34:498a218cf53e:
#include "square_app.h"
SquareApp::SquareApp(Serial* serial) : App("Square wave", serial) {
this->analogOut = new AnalogOut (PA_4);
this->amplitude = 75.0f;
}
void SquareApp::start()
{
App::start();
this->analogOut->write(this->amplitude/75.0f);
this->timer.start();
}
void SquareApp::run()
{
this->analogOut->write(75.0);
}
void SquareApp::stop()
{
App::stop();
this->analogOut->write(0);
this->timer.stop();
this->timer.reset();
}
void SquareApp::setamplitude(float newamplitude)
{
this->amplitude = newamplitude;
}
