Go Down

Topic: How to arduino import var values from text files!! (Read 3498 times) previous topic - next topic



sorry for my poor English,

How to arduino import var values from text files to read from sd card!
My text file is:
myvar1 = 120
myvar2 = 10
myvar3 = 60


Which library are you using to store data on the SD card? Some libraries make it easier to read from the SD card than others.

Depending on how the data is retrieved from the SD card, different methods are available to parse the data.

For data in char arrays, strtok can be used to parse the records, into tokens. If an array contains a single record, strtok can be used to get "myvar1", "=", and "120", or "myvar1 " and " 120", depending on the delimiters passed to it.

The strcmp() function can then me used to compare the name portion, so that the value is stored in the correct variable. The atoi() function can convert NULL-terminated char arrays (as returned by strtok) to integers, if needed.
The art of getting good answers lies in asking good questions.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131