Hello,
Is it possible that you use an if-statement en this will be activated when the arduino is plugged in the computer?
What I want to do is that the arduino normally runs on an battery and when I plug in the USB cable in the computer Arduino is printing certain variables on the serial monitor.