Csharp playground

PaulS:

edit: I have attached the full code here:

I don't think I'll go there for code.

It's just a local site for file shareing. Here, on another, this doesn't have kinky name or pics: serialTest rar.html
here it is on an internation filehost: What Happened to the old DataFileHost?

My opinion that comparing with == it's correct. What would happen if more bytes are sent? Nothing, as expected, because our Arduino sends ONLY 5 bytes.

I forgot to mention:

  • it's a Leonardo Board.
  • debugging it I have found that returnMessage has the value of a cross, a sqare, 2 end of line character and an upper corner ASCII character. returnMessge += Convert.ToChar(currentPort.ReadByte());
  • returnMessage doesn't contain HELLO FROM ARDUINO as wanted

So, in my opinion, this part of the code is wrong:

int count = currentPort.BytesToRead;
string returnMessage = "";
while (count > 0)
{
intReturnASCII = currentPort.ReadByte();
returnMessage = returnMessage + Convert.ToChar(intReturnASCII);
count--;
}

Can you guys please help me? If you will post me link to another handshake that you know or already use, that will be awesome! Thank you in advance.