[c# issue]Serial.println and port.readLine() seem to read different strings..

Hi, I'm making c# read strings from serial port with

 String myStr = port.readLine()

problem is that when I do something like

if(myStr.equals("foo"))

result is always false, even if I sent "foot" with

Serial.println("foo")

in arduino.
How come??

Serial.println("foo") sends 5 characters: "f", "o", "o", "\r", "\n". You have to read the documentation for your port.readLine(), but I guess it reads till a newline character (0x0a) is read. So you have the string "foo\r" in your variable which obviously is not equal to "foo".

It's exactly like that! Thank you! :smiley: