Sending Commands through Serial Monitor

Hello,
I have a piece of equipment that runs via RS232 and sends serial data. To adjust the data that is sent, we have to run a program that was written for windows 98... it does work for windows 8.1 however, we can not get it to work again. (Program does not recognize that the device is on com5, for example). We solved this by using a RS232 to 5 volt TTL converter. I wrote a simple code that takes the serial data and prints it to the screen and everything is working as intended. However, I do not know how to send the commands. The style of commands that would need to be sent have the following form.

M1

All of the commands are alpha numeric containing a letter followed by a number or just a letter (Q).

This is what I have for code so far.

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

void loop(){
  while(Serial.available()>0){
    int in=Serial.read();
    Serial.print(in);
  }
  
  // Send character commands
  
}

any help is appreciated. Thank you

Read this blog paying special attention to the State Machine part.

If im reading that blog correctly, and i may not be, he is taking data in through the serial port and processing it....

What i want to do is send something through the serial port using the serial monitor to the device, not the arduino.

For example, once I have everything wired up and running, the device will send me data. I would like to send it the character " * ". This would stop the device from sending further data and open configuration. If I have to hard code what I want to send the device before hand I can, but I would like a way to quickly change things without rewriting code every time.

Thank you for that article though... it should prove to be useful for something else.

Thank you

Put the character you want to send in single quotes. Not "" but ''.
If I want to send an ASCII 0 I could send 48 or '\48' or '0' with the latter being more clear in the source.
When you use double quotes it makes a string with terminating zero.

What i want to do is send something through the serial port using the serial monitor to the device, not the arduino.

If your gizmo has a RS232 to 5 volt TTL converter, then try connecting the gizmo converter TTL rx to the arduino rx, the gizmo tx to the arduino tx, and connect the gizmo and arduino grounds together. Run a dummy program on the arduino that does not involve the arduino serial port, such as the blink example code. If your gizmo requires a carriage return/line feed terminator with the sent commands, then you need to set that option in the serial monitor.

Thanks for all of the help....

Found out someone had a spare pin connector and a usb to serial connector.... hyper terminal will be easier...

once again thanks for the suggestions and the help.