#include "EspPlcTimers2.h"
espPlcTimer t1(TON, 20000); //TON timer, 20s
espPlcTimer t2(TOFF); // TOFF timer, 10s
void setup() {
TIMERHANDLER; //Call to TimerHandler function
Serial.begin(115200);
pinMode(GPIO_NUM_13, INPUT_PULLUP); //input for the TON timer (green)
pinMode(GPIO_NUM_12, INPUT_PULLUP); //input for the TOFF timer (blue)
pinMode(LED_BUILTIN, OUTPUT); //output for the TON timer
pinMode(GPIO_NUM_15, OUTPUT); //output for the TOFF timer
};
void loop() {
t1.tin(!digitalRead(GPIO_NUM_13));
digitalWrite(LED_BUILTIN, t1.q());
t2.tin(!digitalRead(GPIO_NUM_12));
digitalWrite(GPIO_NUM_15, t2.q());
if (t1.tin() || t1.q()) {
Serial.print("T1: ");
Serial.println(t1.et());
}
if (t2.tin() || t2.q()) {
Serial.print("T2: ");
Serial.println(t2.et());
}
};