Go Down

Topic: c# question reading comport (Read 1 time) previous topic - next topic


I am writing a program in c#, actually i am just learning c# now.

My current program is able to read dummy data series and display it on a graph, (not bad for 2 days c# )
It looks quite well it will show the last 100 measurements in various ways.
If each measurement is based on multiple reading then those are just other lines in the graph.

but now the bad part.. i'm unable to read serial data events i cannt use static event functions to work (cause i dont know how they would call a normal privat function). or i get other kind of errors, its troublesome in short i got multiple kinds of errors trying realize it. if i remove the staic parts it wont work also.. in short I am able to get the data representation part working. but not the serial read part.
(and yes the serial port connector is dropped on Form1), i find it hard to point where it goes wrong sometimes the code runs but just doesnt give an error, and no serial data is read.

Someone care to help? 
posting here a sample in C# for reading a line   {arduino code uses serial.println(string)}  from a serial event, and display it in a textbox
Such a sample i be able to rewrite into my program.


It's not quite as simple as you may think. You have to use C# multitasking
functions, and run the serial routines in the background and your Forms
in the foreground, and bind them together using Delegates so you don't
crash the computer. Take a look at the code in the Smileys Workshop ZIP
file on this page for starters. It has both VB and C# code.



actually this is a real good answer, with this i dive deeper into c#
just as i wanted to understand the language gimmicks

Go Up