Pages: [1]   Go Down
Author Topic: arduino to read CSV  (Read 838 times)
0 Members and 1 Guest are viewing this topic.
Indonesia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 70
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear All.
I just trying to use SdFatLib ... specialy the "tail" sample.

Now .. I have a file called "MYSTEP.CSV" on my sdcard.
The SdFatLib success to "tail" the file content.

basically .. the contents is just a comma seperated values like
Code:
7768,253
7957,254
8547,253
8705,254
10133,255
10293,254
10831,255
11031,254

Question :
How to parse a line to two variable, i.e :
Code:
7768,253
to -->
var1 = 7768
var2 = 253

Sincerely
-bino-
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 603
Posts: 33408
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Get the value into a string.
Step through the string until you see a space. Then from that point to start of the string generate a sub string, that contains your first variable.
Carry on stepping through and note the position of the first number.
Then step through until you get to a none number and make the second sub string.
Logged

Pages: [1]   Go Up
Jump to: