First commit
This commit is contained in:
27
VT_ESP8266/src/leds.cpp
Normal file
27
VT_ESP8266/src/leds.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <leds.h>
|
||||
|
||||
leds::leds(PCF8574 *pcf, int pinLED, int onms, bool inverse)
|
||||
{
|
||||
_pcf = pcf;
|
||||
ledPin = pinLED;
|
||||
inv = inverse;
|
||||
onMS = onms;
|
||||
state = false;
|
||||
}
|
||||
|
||||
void leds::start()
|
||||
{
|
||||
curMS = millis();
|
||||
state = true;
|
||||
_pcf->write(ledPin, !inv);
|
||||
//digitalWrite(ledPin, !inv);
|
||||
}
|
||||
|
||||
void leds::tick()
|
||||
{
|
||||
if(state && ((curMS + onMS) < millis())){
|
||||
state = false;
|
||||
_pcf->write(ledPin, inv);
|
||||
//digitalWrite(ledPin, inv);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user