Pages: [1]   Go Down
Author Topic: Need help: SerialPort write to CSV  (Read 1036 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 642
Posts: 50362
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 223
Posts: 13913
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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

Rob Tillaart

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

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 642
Posts: 50362
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

New Jersey
Online Online
Faraday Member
**
Karma: 70
Posts: 3741
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Will check that up, thanks
Logged

Pages: [1]   Go Up
Jump to: