Turn off line endings in serial monitor. "LT" is not the same as "LT\r\n" (\r is carriage return and \n is new line).

Using the String class can cause memory problems. See the evils of strings. The serial input basics tutorial uses strings (null terminated character arrays).

Hi quad,

if you add serial-output to your code you can see exactly what you received

Add a leasing special character like for example the "#"

and two "##" after printing the content of your variable
be aware of the different commants "pint"
and print**ln **a

print**ln **adda a carriage return und new line


if the received string is exactly the two characters "LT"
the serial-output looks like this


If you have the non-visible carriage return or new line it looks like this


best regards Stefan
any newbee can apply the most professional habit from the first line of code they write on their own:
add only ONE thing at a time. Test/debug that ONE thing until that ONE thing works reliable - repeat.
The sad thing is: only the REAL professionals write code this way.