Arduino sketch questions

Alright, I have a simple Arduino sketch would should send "Hello World!" across the serial TX line. My sketch looks like the following,

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

}

void loop()
{
Serial.println("Hello World!");
delay(1000);
}

I see the TX LED blink for a several seconds then it stops blinking.

Is there any reason why this LED should stop blinking or am I missing something?

It should blink when sending data, does the serial monitor still output every sec despite the LED

dannix:
It should blink when sending data, does the serial monitor still output every sec despite the LED

When I open the serial monitor it starts blinking again.

I'm unsure why yours is acting differently to mine but the fact it's outputting as expected suggests it's ok. Do you have a clone arduino? I'm referring to a pucker arduino uno, it blinks when ever it's transmitting regardless of whether the serial monitor is open or not.

The Tx LED is controlled by the 8u2/16u2. It might only flash the led when the pipe isn't full.

Why?

WizenedEE:
The Tx LED is controlled by the 8u2/16u2. It might only flash the led when the pipe isn't full.

Why?

Yeah it's weird it blinks for a little bit, then stops blinking, then when I open the Serial monitor window it starts blinking again. I figured some buffer was getting full.

ipatch:
When I open the serial monitor it starts blinking again.

Opening the serial monitor resets the Arduino. As to why it stops, can you remove the USB and power it from a different source? Any difference?

yeah when I tried powering the Arduino from my wall wort I didn't see the LED TX blinking at all, but when I hooked it up to the USB power via my comptuer the LED started blinking, and kept blinking as long as I left the serial monitor window open.

ipatch:
yeah when I tried powering the Arduino from my wall wort I didn't see the LED TX blinking at all,

I think you meant "wart", not "wort". Wort wouldn't really wouldn't make sense here.

If nothing opens the serial port on the PC, the TX light won't flash. The TX/RX are driven by the 8u2 itself. It only sends data when the host opens the virtual serial port. This is what makes the TX/RX lights lousy heartbeat indicators. While communication between the 8u2 and ATmega328 does not use handshaking, the communication between the 8u2 and PC does.

Keep in mind this is asynchronous of the ATmega328 sending data to the 8u2. Regardless of what the 8u2 is doing or the status of its buffers, the ATmega328 will continue to send it data.

ipatch:
Yeah it's weird it blinks for a little bit, then stops blinking, then when I open the Serial monitor window it starts blinking again. I figured some buffer was getting full.

You haven't answered the question about what you see in the Serial monitor. I tried your exact sketch on an Uno R3 version, and the Tx LED kept blinking, and I saw this in the Serial monitor window:

Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!

I figured some buffer was getting full.

There is no buffer that will fill up with that, at 9600 baud, with a 1 second delay.

[quote author=Nick Gammon link=topic=114900.msg865973#msg865973 date=1342759478]
You haven't answered the question about what you see in the Serial monitor. I tried your exact sketch on an Uno R3 version, and the Tx LED kept blinking, and I saw this in the Serial monitor window:[/quote]
I took the comments to mean the LED stopped blink when the serial monitor wasn't open.

This behavior I have verified in the past.

[Edit: Removed the part of the sentence I typed twice, for some reason.]

[quote author=James C4S link=topic=114900.msg865976#msg865976 date=1342759775]

yeah what he said /\

OK, yeah, I reproduced that. With the sketch loaded, if I unplug the USB, and plug in a battery, the Tx and Rx LEDs stop blinking. However the logic analyzer shows the data is still being sent from pin D1. So the sketch is running.

The Tx/Rx LEDs are run off the Atmega8U2 chip, and presumably if it does not have an active session going, the software on it is not blinking the LEDs connected to it.

This is no correlation to whether or not the main Atmega328 sketch is working.

[quote author=Nick Gammon link=topic=114900.msg865980#msg865980 date=1342760306]
The Tx/Rx LEDs are run off the Atmega8U2 chip, and presumably if it does not have an active session going, the software on it is not blinking the LEDs connected to it. [/quote]
My guess is the 8u2 raises the virtual "RTS", but the PC never responds with CTS.

[quote author=Nick Gammon link=topic=114900.msg865980#msg865980 date=1342760306]
This is no correlation to whether or not the main Atmega328 sketch is working.[/quote]
Agreed. RX/TX are lousy heart-beat indicators.