Library for heating Nichrome

Nichrome_lib.cpp

Committer:
Sigma884
Date:
2020-03-17
Revision:
0:e1e1b1f8c5d9

File content as of revision 0:e1e1b1f8c5d9:

#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;
}