28 lines
501 B
C++
28 lines
501 B
C++
#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);
|
|
}
|
|
}
|