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.
HeartBeat.cpp
- Committer:
- mbj898
- Date:
- 2012-11-30
- Revision:
- 3:654a22520c76
- Parent:
- 2:fc8dbf3231ee
File content as of revision 3:654a22520c76:
#include "mbed.h"
#include "HeartBeat.h"
HeartBeat::HeartBeat( PinName pwm) : pwmObject(pwm)
{
}
void HeartBeat::pwmIt(float frequency)
{
float delay = frequency /100;
if (delay < .001){
delay = .003;
}
for(float p = 0.0f; p < 1.0f; p += 0.01f) {
pwmObject = p;
wait(delay);
}
for(float p = 1.0f; p > 0.0f; p -= 0.01f) {
pwmObject = p;
wait(delay);
}
}
