Saving/Reading text files to/from Arduino

I have an LED array and a program that I would like to release as open source. With this, I have 6 animation arrays that are displayed depending on a radio transmitters position using 0’s and 1’s to dictate what LEDs are on or off. All works just great.

The thing is, I want to give this project to my friends who are not computer literate but I also want to allow them to change the animations that will be displayed with ease.

Right now, I have all the animations programmed as arrays that are stored in a .h file but updating this file is far too scary for most people. It would be great if I could put all of the arrays in .txt files so that when they updated and saved the text file, the animation would change the next time it was turned on.

Is this possible? How could I make this easy for a “normal” user to update these arrays even if I have to use code to parse these into actual C++ arrays?

Is this device regularly plugged into the computer, or is it externally powered? If the former, you could use some non-volatile storage to store the array, design a protocol to transfer the data through Serial to this non-volatile storage, and write a script that would transfer the contents of the text file over Serial.

It is externally powered but I don't mind (I believe it is actually required) if it has to be connected to a computer to do the changes.

I know you say a serial connection could do the trick but could you be more specific? What methods would I use and how would I save the changes to the Arduino animations when the program is started without re-compiling the sketch?

shiznatix: I know you say a serial connection could do the trick but could you be more specific? What methods would I use and how would I save the changes to the Arduino animations when the program is started without re-compiling the sketch?

Again, you would need a non-volatile way to store the information, such as EEPROM. When the data comes through Serial, it is saved into this space. On start-up, you read the data from the storage into an array. Alternatively, you could use an SD card, and have them make the changes on their computer, to the text file on the SD card, and just plug the SD card back into the SD card shield.

I would recommend an SD card too, if you can spare the pins to control the SD card. If you try the serial port data transfer, then you have to write a program that runs on the computer (cover 3 operating systems?).

Ok, understood. I am using an Arduino Micro which has 1KB of EEPROM which is way too small for my needs, which are about 12KB as text.

What shields / cards / libraries could you recommend that would allow me to edit easily on all 3 major OSs text files totaling 30KB max (which is all I need)?

Something like this: http://www.ladyada.net/products/microsd/

Thanks, I will order one of those (will take a while unless someone knows a good online shop in Europe) but it looks great. SparkFun has them on the cheap so yay. Thanks again for the guidance.

There are also cheaper ones on ebay but watch out for those that don't have a level shifter. They just use resistors. The adafruit module has a level shifter. I've used their data logger shields and didn't encounter any problems. If you update your location information, I'm sure someone from your country or at least from Europe will be able to point to you some shops closer to home.

My location is Tallinn, Estonia with has a very limited supply of Arduino things and I just checked the only places website and was not able to find any SD card shields. Just for info, the website is: http://www.ittgroup.ee/index.php?option=com_virtuemart&Itemid=12&lang=en

If anyone can point to some here in Europe that are cheap I would appreciate it. I am sick of having to wait weeks and pay $15 for shipping for stuff from the USA.

Post on the hardware sub forum a request for vendor list near your country and I may get someone to help out. You can't entirely blame sparkfun. I sell kits I designed worldwide on inmojo.com (like an ebay for diy electronics). The past January USPS raised international shipping effectively doubling the cost. I'm feeling direct hit. $15 is not insane. Just postage will run you around $13, then packing and handling and I hate the customs form. You stand in line for minutes when the USPS clerk types them in. No electronic way for me.

Which forum is the hardware subform? I couldn't find anything in the forum list that matched this (or am I blind?).

Sorry. Haunted by the old arduino forum with hardware sub forum. Try the general electronics sub forum. Just ask for where to buy certain parts in your region.