problem using serial communication

I'm writing a simple code:

void setup( )
{
    Serial.begin(2400);
}
void loop( )
{
    Serial.write(5);
    delay(500);
}

Why does this work (the tx LED glows) only when the serial monitor is opened on the computer and not otherwise? Am I missing something?
I'm using this on Duemilanove and trying to send serial data to a Leonardo.

Can you send over Serial to another device and the Serial monitor at the same time I wonder ?

Here is the schematic. The TX and RX pins LEDs are connected to the usb IC (IC2 pins 22 and 23), not the serial port. They will probably not show serial traffic unless it is going through the usb port.

@SurferTim- Does it mean that data might actually be sent on the tx without the tx LED lighting up? That sounds a bit odd.
Is the method I'm using a correct way of sending serial data ?

a-Jay:
@SurferTim- Does it mean that data might actually be sent on the tx without the tx LED lighting up? That sounds a bit odd.

Not really. If the TX and RX LEDs are controlled by the usb IC, then why would they light if nothing is going through the usb port?

Is the method I'm using a correct way of sending serial data ?

Yes. Do you have the means to check the serial data pins, like a logic analyzer or o-scope?

I don't have a logic analyzer, but an oscilloscope I can find.

Did I mention that I'm using the tx pin (1) on the Duemilanove to send serial data? And with this code, can I infer that the board is actually sending the data, but it is not showing up as tx LED (because it is for the usb IC)?
I was wondering if there's something else that needs to be added to the code to make pin 1 transmit serial data..

a-Jay:
I was wondering if there's something else that needs to be added to the code to make pin 1 transmit serial data..

No. What you have should do it. Bear in mind if you have the serial monitor connected on the usb port, both devices are sharing that serial port.

I was wondering if there's something else that needs to be added to the code to make pin 1 transmit serial data..

You need to make sure that the grounds are connected, if you really want to send serial data.

Okay yes, grounds are connected, no problem there.
What I don't understand is why does the serial monitor have to be clicked open for the Duemilanove to start transmitting anything.

@SurferTim- I expected that. Whatever data I'm sending with Serial.write( ) will go to both the tx pin and the usb port. But as I said, this seems to happen only with the serial monitor open.
Is it necessary to have a listening device ready (like the monitor) to start communicating? I hope not!

It shouldn't, but the o-scope does not lie. Check D1 for a signal. That is the tx line.

a-Jay:
@SurferTim- Does it mean that data might actually be sent on the tx without the tx LED lighting up? That sounds a bit odd.
Is the method I’m using a correct way of sending serial data ?

The Tx LED lights up when the USB chips sends stuff. To do that it has to make a connection to the host.

The Tx LED is not connected to pin 1 of the Atmega328 chip, and thus it doesn’t necessarily light up. Try putting an LED and a series resistor (eg. 220 ohm to 1K) between D1 and Gnd.

resolved

The tx LED doesn't necessarily light up when sending serial data.
Whatever data you send by/to Serial, it is seen by both the tx/rx pins as well as the usb.

Thanks @SurferTim and @Nick Gammon.