Arduino Serial print

Hello all, long time reader/first time poster here. I have what might be a simple question: if I have Serial.print() in my code but do not have the serial monitor open, does the Arduino not proceed until I open it? I ask because when I have my board plugged in to the computer via USB, the program seems to execute just fine. Yet when my project stands alone (not connected to the computer) and I power it up I am not convinced that the program is being executed.

Thanks for any advice

It will go ahead and send your serial data if the monitor is not open. A LED on D0 will indicate output data transfer.

.

Thank you!

I have a program that has been happily sending data for nearly two years without anything connected that can receive the data. It is controlling my fridge. I have three LEDs to show when it is too hot, motor is ON and when it is colder than required.

...R

extreme534: if I have Serial.print() in my code but do not have the serial monitor open, does the Arduino not proceed until I open it?

Depends on the type of Arduino board. Depends on your code.

With Arduino UNO or MEGA the simple answer is no: The code will execute, no matter whether the serial monitor is open or not.

If your program hangs with an UNO or MEGA, it is more likely that a program failure is caused by some hardware connected to your board that needs to be grounded, and the missing grounding: The USB connector of desktop PCs is always connected to GND.

With Arduino Leonardo or Micro, the more complicated anwer is: Depends on your code. There are even official example programs that make your Arduino Leonardo/Micro hang while no USB-Serial is available: https://www.arduino.cc/en/Serial/IfSerial