If I upload any sketch that sends serial data, I immediately see the TX/RX LEDs flash once the sketch is uploaded. If I then start the serial monitor, the sketch appears to restart.
A bare minimum sketch that shows this behaviour:
void setup()
{
Serial.begin(9600);
Serial.println("Setup");
}
void loop()
{
Serial.println("Loop");
delay(1000);
}
Tested with several boards and Mac and Windows versions of the IDE.
Example output - it goes back to "Setup" when I open the serial monitor:
Why is this?