
elec350
Fork of elec350 by
Diff: soft_pwm.h
- Revision:
- 10:021f19a9861f
- Child:
- 11:4685f33a2468
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/soft_pwm.h Wed Oct 21 19:52:30 2015 +0000 @@ -0,0 +1,20 @@ +#ifndef _SOFT_PWM_ +#define _SOFT_PWM_ + +#include "mbed.h" + +class SoftPwm +{ + private: + float period; + float dutyCycle; + Timer timer; + public: + SoftPwm(float initialPeriod, float initialDutycycle); + + void setPeriod(float newPeriod); + void setDutyCycle(float newDutyCycle); + bool isOn(); +}; + +#endif \ No newline at end of file