ニクロム線(MOS-FET)用ライブラリ 時間制御付き
Dependents: Hybrid_IZU2019 SWAN_IZU2019_v1 Hybrid_OB2021_MAIN
Revision 0:0f7a2f7eb52c, committed 2018-11-14
- Comitter:
- Sigma884
- Date:
- Wed Nov 14 09:12:14 2018 +0000
- Commit message:
- ??????MOS-FET???????
Changed in this revision
Nichrome_lib.cpp | Show annotated file Show diff for this revision Revisions of this file |
Nichrome_lib.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 0f7a2f7eb52c Nichrome_lib.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Nichrome_lib.cpp Wed Nov 14 09:12:14 2018 +0000 @@ -0,0 +1,26 @@ +#include "Nichrome_lib.h" +#include "mbed.h" + +Nichrome_lib :: Nichrome_lib(PinName userPin) : nichrome(userPin){ + nlib = this; + nichrome = 0; + status = false; +} + +void Nichrome_lib :: fire(float time){ + if(time <= 0.0f){ + return; + } + fire_on(); + stopTime.attach(nlib, &Nichrome_lib::fire_off, time); +} + +void Nichrome_lib :: fire_on(){ + nichrome = 1; + status = true; +} + +void Nichrome_lib :: fire_off(){ + nichrome = 0; + status = false; +} \ No newline at end of file
diff -r 000000000000 -r 0f7a2f7eb52c Nichrome_lib.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Nichrome_lib.h Wed Nov 14 09:12:14 2018 +0000 @@ -0,0 +1,26 @@ +#ifndef NICHROME_LIB_H +#define NICHROME_LIB_H + +#include "mbed.h" + +class Nichrome_lib{ + + public: + Nichrome_lib(PinName userPin); + bool status; + private: + DigitalOut nichrome; + Nichrome_lib *nlib; + Timeout stopTime; + + public: + void fire(float time); + + public: + void fire_on(); + + public: + void fire_off(); +}; + +#endif \ No newline at end of file