All tutorials

5 · Communication & data

Detect a freeze (watchdog)

Expert22 min

Goal

Report when a reading has not been refreshed for 3 seconds.

Why it matters

A reliable system detects its own failures instead of showing stale data.

Steps

  1. 01Store the timestamp of the last valid reading.
  2. 02In loop(), compare millis() to that timestamp.
  3. 03Past 3000 ms, light the alert LED and report on the serial port.

This tutorial runs inside the Circuitly simulator: your wiring and your code are checked automatically at every step.

Next tutorials