Go Down

Topic: Csharp playground (Read 1 time) previous topic - next topic

fulminator

#10
Jan 27, 2013, 08:18 pm Last Edit: Jan 27, 2013, 08:29 pm by fulminator Reason: 1

Quote
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: http://www.filehost.ro/29219539/serialTest_rar/
here it is on an internation filehost: http://www.datafilehost.com/download-98c72190.html

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:
Quote
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.

PaulS

"Find a real sex partner in California". Really, can't you just attach the damned code?

Quote
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.

Then, testing for 5 or more shouldn't be an issue.

Quote
- it's a Leonardo Board.

Earlier, a not disappeared from my statement. The C# code you posted earlier does not open the serial port correctly to talk to a Leonardo. To communicate with a Leonardo, the DtrEnable property of the SerialPort object must be set to true. For other boards, setting DtrEnable to true (the default is false) does not affect the Arduino.

fulminator


"Find a real sex partner in California". Really, can't you just attach the damned code?

Quote
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.

Then, testing for 5 or more shouldn't be an issue.

Quote
- it's a Leonardo Board.

Earlier, a not disappeared from my statement. The C# code you posted earlier does not open the serial port correctly to talk to a Leonardo. To communicate with a Leonardo, the DtrEnable property of the SerialPort object must be set to true. For other boards, setting DtrEnable to true (the default is false) does not affect the Arduino.


I am terrible sorry for that, I replied already to the admin that I wasn't aware of that. Sincerely, that site it's only filehost site, but whateva. And about the question, you right, dude. I can't recall did something good. And I haven't upload a file in ages.

Thank you. It 'kinda' works right now. I get the right port name saved in a variable as I wanted for further use. Problem solved.

One thing remains, though... How can we contact the admins to repair the code in the csharp playground? I am sure a lot of people check that page first, so it would be nice if it will be corrected. And ofcourse, a DtrEnable information with bold and red fonts.

Coding Badly


To attach a file to a post...

• Start a post (click Reply) or modify one of your existing posts
• Click Additional Options... (below the edit window to the left)
• Click the Browse button
• Select the file
• Click Post

Coding Badly

One thing remains, though... How can we contact the admins to repair the code in the csharp playground?


Not necessary.  The Playground is a public wiki.

Go Up