I recently finished an open source library to read sketch settings from an SD configuration file. I use the library instead of re-downloding the sketch every time some simple setting changes.
I can put a file on my SD card containing lines like
ssid=wickedOz
password=flyingMonkeys
then my sketch can read those settings using the library. The library lets me write sketches that can be reconfigured without reprogramming. For example, to switch to a new Wifi hotspot, I just use my PC to edit the configuration file, put the SD card back in my project, and off it goes.
I'm using the library in my Robotic Glockenspiel project, to give the URL of the glockenspiel playlist:
hello
i have seen your library
the things are that i cannot understand properly the way it works
is there any way that you can sample an mac and ip in the config.txt in order to connect it a w5100 shield?
thank you
network_sdcard.ino: In function 'void setup()':
network_sdcard.ino:123:1: error: unable to find a register to spill in class 'NO_REGS'
network_sdcard.ino:123:1: error: this is the insn:
(insn 160 157 163 7 (set (mem:QI (post_dec:HI (reg/f:HI 32 SP_L)) [0 S1 A8])
(subreg:QI (reg/f:HI 183) 1)) network_sdcard.ino:79 1 {pushqi1}
(expr_list:REG_ARGS_SIZE (const_int 1 [0x1])
(nil)))
network_sdcard.ino:123: confused by earlier errors, bailing out
Error compiling.
This is the error i have got
If i modifying it like:
Serial.print("mac ");
sscanf(netBuffer,"%2x:%2x:%2x:%2x:%2x:%2x",myMac[0],myMac[1],myMac[2],myMac[3],myMac[4],myMac[5]);
break;
So removing the & will compile it but the output will be 0:0:0:0:0:0
Regards
On IDE v1.6.0 (and all 1.5.x versions), I get an internal compiler error segmentation fault. With IDE v1.0.6, it compiles fine. It is caused by the sscanf calls.
Do you need a separate library? Basic SD card file reads together with a simple string parsing procedure (assuming that you are reading line input) can solve this problem. I use a procedure named ENDF (ExtractNextDelimitedField) to parse text lines that I read from files.
I note that you still have to remove the SD card and edit your config files on a PC. I guess that means you have to have physical contact with your Arduino system. You might as well made a code change and download an updates sketch.
I have built file upload and download functionality into my Arduino system. So I can and do upload my system's configuration files from remote locations while the application is running. For some files my system will pick up file changed content automatically. For others I would still have to restart the system because the files are only processed in the setup() procedure in the current code.
All of my application's source code is published on its website at http://www.2wg.co.nz within the public folder on the SD card. Note that you would need an Arduino processor with 8KB of RAM to implement SD card file uploads through a web page upload.