pwm manijk
Revision 0:526351bcb96b, committed 2020-01-21
- Comitter:
- mlucan
- Date:
- Tue Jan 21 12:11:26 2020 +0000
- Child:
- 1:571764dcabdc
- Commit message:
- PWM upravljac
Changed in this revision
UpravljanjePWM.cpp | Show annotated file Show diff for this revision Revisions of this file |
UpravljanjePWM.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UpravljanjePWM.cpp Tue Jan 21 12:11:26 2020 +0000 @@ -0,0 +1,38 @@ +#include "UpravljanjePWM.h" +#include "mbed.h" + +UpravljanjePWM::UpravljanjePWM(AnalogIn pin) : ain(pin) {}; + + float UpravljanjePWM::pwm1(bool onOff, bool smijer) + { + float pwm=0; + + if(onOff==false) { + pwm=0; + + } else { + if(smijer) { + pwm=ain; + } else { + pwm=0; + } + } + + return pwm; + } + float UpravljanjePWM::pwm2(bool onOff, bool smijer) + { + float pwm=0; + if(onOff==false) { + pwm=0; + + } else { + if(smijer) { + pwm=0; + } else { + pwm=ain; + } + } + + return pwm; + } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UpravljanjePWM.h Tue Jan 21 12:11:26 2020 +0000 @@ -0,0 +1,15 @@ +#ifndef MBED_UPRAVLJANJEPWM_H +#define MBED_UPRAVLJANJEPWM_H + +#include "mbed.h" + +class UpravljanjePWM{ + public: + UpravljanjePWM(AnalogIn pin); + float pwm1(bool onOff, bool smijer); + float pwm2(bool onOff, bool smijer); + + private: + AnalogIn ain; + }; + #endif \ No newline at end of file