This is basically a HW approach.
Two channels, single chip, most resources still available for other tasks, see right hand window.
Window to its immediate left other capabilities / resources on the chip for use.
The LED and R are offchip, the rest onchip.
Basically a timer is constantly reloaded by the input stream, when that fails the timer overflows
and fires another timer to generate a known pulse or reset or ........whatever. You may
not need that secondary timer if you do not care about the width of detect missing pulse used
by rest of system for control/notification. The edge detector used to control which edge the
system is reset on.
The control of the receivers and emitters can also be done onchip via use of onchip OpAmps
and comparators.
The IDE (PSOC Creator) and Compiler free, a good board to start with is $ 10, including debug.
Regards, Dana.