Uno and Serial monitor only work "once"

I have a sketch uploaded on the Uno. It outputs data (Serial.write) and it works. But if I disconnect it from the computer and then connect it again (either right away or the day after), Serial monitor doesn't work.

I have to upload the same sketch again before I'm able to connect with serial monitor.

You need to restart the serial monitor application (close it and start it from within the IDE); no need to upload the sketch again.

That's my experience; IDE version 1.6.6

I tried that. Even restarted the computer. Didn't help.

I tried closing both the serial monitor and the Arduino IDE before unplugging the Uno.
But it still wont connect after I unplug the USB cable.

I'm using IDE 1.6.7

Can you upload a sketch at any time (without using the monitor)? If you can upload a sketch, that means the Serial connection is working and the monitor will work. Post your code that is giving this effect in code tags. Have you tried uploading a basic serial/debug sketch and seeing if the issue continues?

Yes, I can upload at any time. No errors or anything.
The code is not the problem :slight_smile:

int i = 0;

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println(i);
  i++;
  delay(1000);
}

I have 1.6.7 and it all works for me. Used this trivial test code:

void setup() {
  Serial.begin(9600);
  Serial.println("starting");
}
void loop() {
  Serial.println("hello");
  delay(1000);
}

Uploaded, opened serial monitor, output as expected
Closed ide, opened ide and just left the bare minimum sketch there, opened serial monitor, output as expected
Unplugged and replugged Uno from usb, opened serial monitor, output as expected.

I know, strange right?
Must be something wrong with the Uno.
Tested with another Arduino and it worked as expected.
It was a Mega 2560 but anyway.
I'll get another Uno.

xl15:
I know, strange right?

One of life's little mysteries

Case closed.
Tried with another Uno. It worked.
The first one must be a little bit broken.