Run with or without USB connected

Hi,
I am running a program on the OV5640 sensor.
When i like to debug or test the program, i would like to see results with the print() instruktion. I can program that or not…

But if the OV5640 sensor is running without the USB cable ( “stand alone” ) the print() instruktions are not necessary. (only if i use a screen shield, right?)

What does happen with the print task, when no USB is connected?

How can i tell, that the OV5640 sensor “sees” a usb cable is connected or not, so i can use that in my program?

does is make a difference in CPU process time; printing or not printing?

Thanks!
BR Gerrit

Not much processing happens, the text get copied to a buffer if USB is connected, so you can leave the print statements. If you want check if USB is connected try:

import pyb
usb = pyb.USB_VCP() 
if (usb.isconnected()):
   print("d")