On my notebook I have a USB port that is powered even if the computer is turned off. In my sketch I measure battery voltage every few seconds and send the value via Serial.writeln to the computer and after a few minutes I save a summary to the EEPROM (the power is lost for a short moment when powering on the computer but long enough to reset Arduino even with my largest cap between GND and 5V).
When I turn the computer off the Arduino works but when it should send data the TX LED stays on instead of a short blink. I am not sure what happens and din't test it because I din't want to turn computer on, make a test, turn it off, turn it on and see results, repeat...
I have used this method with another sketch on Arduino Nano clone with the CH 340 USB/serial converter and it worked well. When uploading the sketch on the Nano works as expected. Do you have any ideas where may be a problem? Does the stuck TX mean the whole Arduino is stuck?
Thanks for help.
Smajdalf:
Does the stuck TX mean the whole Arduino is stuck?
I don't know but it would be very easy to add some test code. Just make another LED bink. If it continues to do so the answer is NO.
...R
Well I hoped it is a know "feature". Because discovering if the Arduino is stuck is just a minor (and easy) part of the problem. There are many more questions: why this happens? What else is not working as expected when this happens? What will the Serial do when the computer starts responding again? Ofc I could get answers myself by experimenting and possibly reading the source codes of Serial library and the USB/Serial converter but I hoped someone else encountered such behavior because it doesn't look like so rare to send data to USB without an active Master on the other side.
send the value via Serial.writeln
No such method.
PaulS:
No such method.
Sorry, meant Serial.println
I KNOW that an Arduino will happily Serial.print() for ever when nothing is connected to the Serial port. AFAIK my PC switches off its USB ports when it shuts down so I have never thought to try what you are describing.
Why don't you do the testing and become the Forum expert on the subject.
...R