Skip to main content

Timer Widget

👁 Display

The Timer widget displays elapsed or remaining time. It can count up from zero or count down to zero from a value supplied by the device. Commonly used for machine run-time, watering schedules, cycle counters, or process monitoring.

Default size: 2 × 2 grid cells


Configuration

PropertyTypeDefaultDescription
modecountdown | countupcountupTimer direction
formatmm:ss | hh:mm:ss | autoautoTime display format
DevicedeviceThe device to read from
PinV0V255The virtual pin (sends seconds)
LabelstringWidget label

Pin value convention

The device sends the current timer value in seconds:

ScenarioValue sent
Countup: 2 min 37 s elapsed157
Countdown: 5 min remaining300 then decrements
Reset0

Firmware example: count-up (machine run time)

unsigned long startMs = 0;
bool running = false;

VWIRE_RECEIVE(V0) {
int cmd = param.asInt(); // 1=start, 0=stop/reset
if (cmd == 1) { startMs = millis(); running = true; }
else { running = false; }
}

void loop() {
Vwire.run();

if (running) {
unsigned long elapsed = (millis() - startMs) / 1000;
Vwire.virtualSend(V0, elapsed);
}
delay(1000);
}

Firmware example: countdown (irrigation timer)

int remaining = 0;

void startIrrigation(int seconds) {
remaining = seconds;
}

void loop() {
Vwire.run();

if (remaining > 0) {
remaining--;
Vwire.virtualSend(V0, remaining);

if (remaining == 0) {
stopValve();
Vwire.virtualSend(V0, 0);
}
}
delay(1000);
}

Tips

Push every second

For a smooth visual countdown/countup, push the value every 1000 ms on the device. The widget does not auto-tick — it always shows the last received value.