Arduino string issues

Hello Im trying to send a string to arduino from a computer and then print it back out to me
but it keeps sending numbers when I type letters
what code should I use?

C/C++

what code should I use?

The correct code.

You have the question backwards, though. The question is "Here is the code I am using. Can you help me make it do what I want?"

#include <LiquidCrystal.h>

// Connections:
// rs (LCD pin 4) to Arduino pin 12
// rw (LCD pin 5) to Arduino pin 11
// enable (LCD pin 6) to Arduino pin 10
// LCD pin 15 to Arduino pin 13
// LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

int backLight = 13; // pin 13 will control the backlight
String g = "";

void setup()
{
Serial.begin(9600);
pinMode(backLight, OUTPUT);
digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
lcd.begin(16,2);
}

void loop()
{
g = Serial.read();
// columns, rows. use 16,2 for a 16x2 LCD, etc.

lcd.setCursor(0,0); // set cursor to column 0, row 0 (the first row)
lcd.print(g);
Serial.print(g); // change this text to whatever you like. keep it clean.

delay(400);

}

g = Serial.read();

g is a String object, but Serial.read returns "int"s.

Maybe you can add an int to your String.

I want it to read words.. what command can I use to read strings from serial()?

the link doesnt help me since Im not sure what exacly im supposed to be looking for... could you please tell me what code I should use?/how to read a string?

if (Serial.available ()) {
  char c = Serial.read ();
  g += c;
}

I need a string not a single char...

A string is just a collection of chars.

void loop ()
{
  if (Serial.available ()) {
    char c = Serial.read ();
    g += c;
  }
}

Some working code that captures characters into a string:

// zoomkat 8-6-10 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(1);  
    	char c = Serial.read();
        readString += c; 
        }
        
      if (readString.length() >0) {
      Serial.println(readString);
      
      readString="";
      } 
   }