ENTER key In Serial

hey there guys!

im trying to make a home automation system for an infocus projector, its controlled over rs-232, the problem is at the end of the commands it needs to see the ENTER key, i was using CoolTerm on a mac and some applescript which sent the command over like this

(<PWR=1>
)

but when i try to do the same in the arduino IDE it thinks the next line isnt connected to the first and raises an error

Any help is appreciated

Open the serial monitor and check the options available on the bottom bar.

i need to program the arduino to send it on a software serial line when it recieves another serial message from the computer

if it helps, coolterm says the it emulates the ENTER key with CR+LF but i dont know how to put that into my arduino code

You mix Arduino code and stuff on the PC. CoolTerm is an application running on the PC as is the Arduino IDE. Programming the Arduino means you upload a program to the little board and the processor on it runs that program.

Maybe you need to describe in a bit more length what you want to achieve and provide links to all the components you plan to use.

JT1777: i need to program the arduino to send it on a software serial line when it recieves another serial message from the computer

In the below simple code the ln part of "Serial.println" adds a carriage return and line feed to what is being sent.

// zoomkat 7-30-11 serial I/O string test
// type a string in serial monitor. then send or enter
// for IDE 0019 and later

String readString;

void setup() {
  Serial.begin(9600);
  Serial.println("serial test 0021"); // so I can keep track of what is loaded
}

void loop() {

  while (Serial.available()) {
    delay(2);  //delay to allow byte to arrive in input buffer
    char c = Serial.read();
    readString += c;
  }

  if (readString.length() >0) {
    Serial.println(readString);

    readString="";
  } 
}

if it helps, coolterm says the it emulates the ENTER key with CR+LF but i dont know how to put that into my arduino code

Maybe you just look for

Serial.print("\r\n");

(what is maybe an equivalent to Serial.println("") or to Serial.println("\r"), depending on what the ardu lib is sending as the "ln" of the "println".)

thanks for your suggestions, i am trying to make an InFocus projector be controlled by an arduino, basically when the arduino recieves a serial command (EG, powerON) it sends the projector itself the relevent serial commands (EG <PWR=1>)

the projector connection details are this:

Baud: 115200
Databits: 8
Parity: none
StopBits: 1
Power Up Command: <PWR=1> Carriage Return/Line Feed
Power Down Command: <PWR=0> Carriage Return/Line Feed

when you look it up the serial commands above ARE DIFFERENT to the commands in the user manual but the commands in the user manual are known to be incorrect and the ones above are the correct commands

thanks

… which sent the command over like this
(<PWR=1>
)

so what you need to send is:

Serial.print("<PWR=1>\r\n");

Thomas33:

… which sent the command over like this
(<PWR=1>
)

so what you need to send is:

Serial.print("<PWR=1>\r\n");

which is exactly the same as

Serial.println("<PWR=1>");

and in this case is better written as

Serial.println(F("<PWR=1>"));

to save some RAM by moving the constant string into the flash memory.