Open file and store data

This may be easy than I think but how do I go about opening a text file stored on my computer and storing the data into an array in arduino memory?

Send the content of the file on serial port to arduino. The sketch running on arduino will read the bytes (characters) and store them.

GoBetwino can do that.

You will have to write the Arduino code to recieve the data your self, but GoBetwino can open the file, read the contents one line at a time and send it out the serial port for you.

GoBetwino sounds interesting but I'm not sure it's exactly what I'm looking for.

Is writing the code myself very complicated? Does anyone have sample code for opening a text file?

Thanks again,

If GoBetwino is overkill for your need you can use a simple VB script (on Windows only) like this (you need to modiy it probably)

'Posted in Arduino forum by florinc 01-02-2009 thread

Const ForReading = 1
Const ForWriting = 2

’ open USB serial port (COMx);

’ If the serial monitor in Arduino IDE is open, you will get an “access denied” error.
’ Just make sure that the serial monitor is closed (so bytes are not sent by the arduino board).
Set fso = CreateObject(“Scripting.FileSystemObject”)
Set com = fso.OpenTextFile(“COM4:9600,N,8,1”, ForWriting)

’ read content of text file line by line;
’ write line to COMx;

Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objFile = objFSO.OpenTextFile(“C:\docs\quotes.txt”, ForReading)

MsgBox(“Ready to write file content to COM”)

Do While objFile.AtEndOfStream <> True
’ read a few (10) characters at a time; serial buffer is limited to 32 characters;
’ writing a character to eeprom takes about 11 ms (assuming that there is no serial.prints in the loop);
’ therefore, after each batch of 10 chars sent to COM, we should wait no less than 110 ms;
’ we use 200 to have a margin of safety;

strChars = objFile.Read(10)


MsgBox(“Finished writing to COM”)