Arduino Micro Serial.println

Hey guys!

I have some code set up with the RXTX library in Java in order to send messages from my computer to my Micro. At the moment, whenever my Serial Monitor is open, the TX pin on the Micro lights up and says whatever I said on Serial.println(). The issue is when I do no use the Serial Monitor and I send the same message through Java, the RX pin lights up and the Arduino does its job, but the TX pin does not light up, and my serialEvent interrupt does not trigger. Is there a way to have Serial.println() still send over a USB connection without the Serial Monitor needing to be open? The Arduino code is below:

int LED = 9;
int recv = 0;
void setup() {
Serial.begin(9600);
}

void loop() {
if (Serial.available() > 0)
{
recv = Serial.read();

if (recv == 121)
{
analogWrite(LED, 120);
Serial.print("--Arduino received: ");
Serial.println(recv);
} else
{
analogWrite(LED, 0);
Serial.print("--Arduino received: ");
Serial.println(recv);
}

}
}

I tried it with the Processing duplex serial example (Java) running on Win7 against a Mega.

Works in both directions, so you messed up your Java code, which you did not post.

Good luck.

Your Java code may need to ensure that DTR or / and RTS is set.

You may also like to try the newer JSSC library in place of RXTX.

...R