Here's the deal:
I am trying to take chars read in using Serial.read() and put them into a string. I can do that by creating a string and concatenating the read char to the String object. The problem comes when I try to write it back to serial or even an LCD.
The code I am using to read the word or phrase from serial is :
String messageString;
char checkChar;
if (Serial.read() == '|') {
while (checkChar != '|') {
checkChar = Serial.read();
messageString = messageString + String(checkChar);
}
}
When I go to write it back i simply get a some numbers or random characters.
I can write to serial using Serial.print(String("Test")) but I get the random numbers when I use Serial.print(String('Test')).
I'm sure it's something I don't understanding regarding strings, chars and String objects. i.e. the ' ' and " ".
Any help you can provide would be greatly appreciated!
Thanks!