Using android phone to control remote dimmer

i tried to directly wire up from arduino to RS-232 ( yea seriously). and I try to write a program.

unsigned long = dimmerON = 0x02FF400D; // i tested those of hex (02 FF 40 0D) can be turned on the remote dimmer by serial device tester
unsigned long = dimmerODD = 0x02FF000D; // and this hex can turn off the remote dimmer

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

void loop()
{
if (Serial.available () == 0)
{
Serial.print ( dimmerOFF,HEX);
}

if ( Serial.available () == 1)
{
Serial.print (dimmerON, HEX);
}
}

i tested this program and i watched the status from the serial monitor, it kept print the value 2FF000D repeatedly
while i send 1 to the monitor, it changed the value to 2FF400D but still repeatedly
and i tried to send another num to monitor, it stopped.

how come the value keep looping, how can i send hex once only?

however i tried the above step after i connected between TX,RX and GND of arduino board and 232port 2,3,5 pin.
i sent 1 out , i could see the monitor that showed the hex of 2FF400D, but the remote dimmer didnt turn on.
what's the problem here?