Serial.print cannot be found by serialevent

I am trying to send a message via serial, ie Serial.println("move") and then use the serial event strucuture to find it and make it do something after that. It works if I type it into the serial monitor, but not when I use Serial.println or Serial.write("move\n"). I have tried all endline options and spent hours on this, does anyone have any advice?

Many thanks,
Sam

The serialEvent() function, if it exists in your program, will only run if Serial data is received, not if is sent.

For what it is worth, the serialEvent() function does nothing that you couldn't easily do for yourself by testing whether Serial data is available. It is not interrupt driven and is only called at the end of loop() if Serial data is available.

What is it that you are trying to achieve ?

Serial monitor does not echo back to your Arduino, so serial event is absolutely useless.

You already know what you're sending, so make use of that.

char data[20] = "move";
// print it
Serial.println(data);

// do something with data; in this case append some other text
strcat(data, " done");

// print update data (just for debugging)
Serial.println(data);