I am working on a project where I am using my Espruino board to monitor Serial1. With regular intervals there are a couple of bytes arriving. The message contains status information, and I have to take action depending on the status bits. The action can be to turn on some LEDs that show status and fault information.
I have figured out how to read the status bytes by converting them to decimal numbers, but I am struggling with how to detect if the communication suddenly stops. For example, the gadget that I am monitoring goes silent because there is a power interruption. How can you detect that there has been no communication for 3 seconds, for example?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I am working on a project where I am using my Espruino board to monitor Serial1. With regular intervals there are a couple of bytes arriving. The message contains status information, and I have to take action depending on the status bits. The action can be to turn on some LEDs that show status and fault information.
I have figured out how to read the status bytes by converting them to decimal numbers, but I am struggling with how to detect if the communication suddenly stops. For example, the gadget that I am monitoring goes silent because there is a power interruption. How can you detect that there has been no communication for 3 seconds, for example?