IgetState() returns the current output state of the specified timer.
bool IgetState(uint8_t timer_id)
| Command | Arguments | Return Value | Operation |
|---|---|---|---|
IgetState(timer_id) | uint8_t timer_id — Timer number. Supports 0 ~ 255 | bool | Returns the current output state of the specified timer. |
This example selects MPINO-8A4R(T)-S and uses input P0 and output P32. Call the command on every pass through loop() without blocking it. Read the current output state of Iton(0, …) with IgetState(0) and apply it to P32.
const uint8_t INPUT_PIN = 0; const uint8_t OUTPUT_PIN = 32; void setup() {} void loop() { const bool inputOn = digitalRead(INPUT_PIN) == HIGH; Iton(0, inputOn, 1000); // Update the timer in every loop before reading its state. const bool done = IgetState(0); // Read the output state of the timer with the same ID. digitalWrite(OUTPUT_PIN, done ? HIGH : LOW); }
loop() so elapsed time and OFF input are processed.timer_id between different timer operations; use a separate ID for each.