Connecting arduino with stellarium

Have a look at this forum post:

The code in post #5 is similar to yours. Note the problem and the solution that was give in post #7.

I'm guessing that you need to add in a CR & LF to your response message.

Change

Serial.print ("#");

to

Serial.println ("#");

inside both your if statements and see if that helps.