Go Down

Topic: Need help: SerialPort write to CSV (Read 1 time) previous topic - next topic

doughng

I'm working on a project with makes me read values from my Arduino Mega and use it in a game engine software based on C#. Now I need to write the SerialPort data to CSV. Can someone please put me through this?

PaulS

There needs to be some application listening to the serial port. That application needs to collect the serial data, and write it to a file, with commas between the values, and save the file with a .csv extension.

What part of this do you need help with?

doughng

Yes, I used the C# SerialPort class to read the data(decimal values), and use it in my game engine. But now, I want to write those same values to csv. I'm a beginner. Thanks

robtillaart


Search www.codeproject.com for csv classes as that is a C# forum
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

doughng

I did, but still dont understand most of the things I saw there. I splitted my values from the SerialPort and have something like array[0]....array[4], and this is what I need to write as a CSV. Please I need help

PaulS

Quote
I splitted my values from the SerialPort and have something like array[0]....array[4], and this is what I need to write as a CSV.

This no longer has anything to do with Arduino. Grab a C# book, and look up how to create a file (which returns an input stream and/or output stream). Look up how to use that stream to write data to the file. The fact that the file needs to have an extension of .csv, and that the values written to the file need to be separated by commas is completely extraneous to the task of writing data to a file.

wildbill

C# book is one way, or just google a little - here's one useful result: http://msdn.microsoft.com/en-us/library/8bh11f1k.aspx


Go Up