Library for heating Nichrome
Diff: Nichrome_lib.cpp
- Revision:
- 0:e1e1b1f8c5d9
diff -r 000000000000 -r e1e1b1f8c5d9 Nichrome_lib.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Nichrome_lib.cpp Tue Mar 17 12:30:27 2020 +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