Update serial monitor after disconnecting from computer?

Hi all,

I have an Arduino Uno R3 running servo motors repetitiously depending on whether a photoresistor detects light. So when the light goes from on to off, the cycle restarts, and I have the serial monitor in the Arduino IDE record the number of repetitions. The Arduino Uno is currently connected to a computer via USB. I'm using a Mac and have the baud at 115200. I want to be able to disconnect the computer from the Arduino Uno, and then later reconnect, and have the serial monitor update how many repetitions have been performed since I've been gone. Is this possible?

I apologize if there's a blatantly obviously answer to this question. I've spent some time searching the forum and Googling, and have not had any luck. Thanks much for any input.

By itself, Serial does not detect, if anything is connected at the other side.
And SerialMonitor by itself is passive and does not tell whether it's listening.
By default, it resets the whole Arduino on connect, which you have to avoid as well.

Thus

  1. There's no "blatantly obviously answer" AFAIK
  2. You have to take measures that reconnecting SerialMonitor resets the Arduino and erases all collected data.
  3. SerialMonitor has to either signal a "goodbye" before disconnecting,
    or ( IMO better ) request collected data when ready to receive.
  4. You have to think about the RAM space required for buffering if its more than just one counter that rises and simply has to be maintained while SerialMonitor is disconnected. In that case, Point 3 is irrelevant, Serial updates while disconnected are simply lost, and SerialMonitor receives the bigger counter later.
  5. If you want to keep such information over a power off and/or reset, you might consider store this counter in eeprom.

I want to be able to disconnect the computer from the Arduino Uno, and then later reconnect, and have the serial monitor update how many repetitions have been performed since I've been gone. Is this possible?

You should be able to simply try it and see what happens. To defeat the serial monitor resetting the arduino, try connecting a 100 ohm resistor between the arduino 5v pin and the arduino reset pin. This defeats the arduino reset when the serial monitor opens/closes when connected to the arduino.