|
-
February 22nd, 2010, 02:46 PM
#1
Recieving data from Serial Port
Hi all,
I have been struggling for a while now with using events to receive a string from a serial port and using the data inside my main function.
To set a bit of context i am sending movements for a buggy to follow and when a movement is complete, the buggy returns a "D". When the program receives this, the next coordinate should be sent.
I'm sure there is a tidy way of doing this avoiding global variables and i would very much appreciate it if someone with more knowledge in this area could lend a hand.
Code available on request.
Thanks in advance, Chris Augier.
-
February 23rd, 2010, 05:46 AM
#2
Re: Recieving data from Serial Port
 Originally Posted by chrisaugier
I'm sure there is a tidy way of doing this avoiding global variables and i would very much appreciate it if someone with more knowledge in this area could lend a hand.
I don't have a lot of experience of reading from a serial port. But the way you have phrased your question suggests that you have a more general problem. The structure of your program and communication of data through the system can be independent of the target data source. The fact that you are communicating with a serial port shouldn't affect how you deal with variables. Without knowing the exact problem you are facing I would recommend object oriented principles and events for communications (You are already using events by the look of it). Are you facing a specific problem or are you just looking for some pointers to improve what you already have?
-
February 23rd, 2010, 06:37 AM
#3
Re: Recieving data from Serial Port
http://www.dreamincode.net/forums/in...howtopic=35775
this link talks abt comport read/write operation using C#...
-
February 23rd, 2010, 08:46 AM
#4
Re: Recieving data from Serial Port
here is a little simpler snippet on reading and writing to the serial port.
http://www.dreamincode.net/code/snippet2764.htm
===============================
My Blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|