Hi All,Would someone be willing to provide an example of how to read/populate a variable from a file on an SDCard?Currently all of the variables are written directly into code such as...

byte ip = {192,168,1,1};

int StationID = 1;

etc...

My goal is to have a .txt or .ini file on the SDCard with this info so a user can provide the changes without having to recompile and upload to the device.I don't really care what the file is called and i am not too worried about the structure.Something like... StationID = 1 ArduinoIP = 192,168,1,1Would be fantastic and reasonably self-explanatory to the user.

My current hardware configuration is the Arduino UNO with the Ethernet/SD Shield purchased from Adafruit.I have been accessing/working thru the examples on the SDCard with the SDFat lib.

Sorry but I only have a week or so of experience with Arduino/C and learn mostly by example and doing.I just haven't found anything yet i can get my head around yet.

Reading data from a file is the inverse of writing data to the file. So, the first thing you need to define is the EXACT format that the data in the file will have.

The next thing you need to do is to be able to read a record from the file. Precisely how to do that depends on exactly which library you are using to read from the SD card, and exactly how the data is written to the SD card.

Finally, you need to parse the data in that record. You could use strtok() to extract the tokens, and atof(), atoi(), etc. to convert the tokens to numbers, or you could use sscanf to extract the data from the record.

The token approach is better if the record format changes a lot (one value, then 5 values, etc.). The sscanf approach is easier if the records are all alike (and don't contain floats).

Next I am reading the file line by line using the full code below.But I cannot figure out how to set the var .... I continue to get 55: error: invalid array assignmentThis is the section of code where i am trying to set it...

created Nov 2010 by David A. Mellis updated 2 Dec 2010 by Tom Igoe modified by Bill Greiman 11 Apr 2011 This example code is in the public domain. */#include <SdFat.h>SdFat sd;

void setup() { Serial.begin(9600);

// Initialize SdFat or print a detailed error message and halt // Use half speed like the native library. // change to SPI_FULL_SPEED for more performance. if (!sd.init(SPI_HALF_SPEED, chipSelect)) sd.initErrorHalt();

Okay, there is the code for a class that does what you need. I'll paste a sample config file below.

You can change the type of value you are reading easily. Use atoi() for an int, use atof() for a float. A character string is even easier. With this, you need to decide what your parameters are ahead of time, which is pretty normal.

Then change the getters (methods that return your values) accordingly.