Sending a .txt file via computer and reading it via Arduino

Hello all,

I am currently using an Arduino Uno with a Ladyada motor shield for a project to run several motors. I need to to be able to send a .txt file or similar to the Arduino using a computer. I am curious as to how I can send the text to the Arduino where it will be able to pick apart the said text letter by letter and read each sentence, word, paragraph, etc... in order that they appear. The motors will in-turn respond to the sequence and appearance of letters. For example, if the text file contains the word "computer", I want to be able to give the motors commands corresponding first to the letter "c" then "o" and so on. If anybody has any ideas as how to go about this, please let me know. Thanks!


You need to write a parser that can distinguish commands and parameters.

simplest model is one command with params per line, separated by spaces. commands would look like :

M 1 300 10 // meaning set motor 1 to 300 for 10 seconds M 2 150 5 etc

There are hundreds of threads asking for serial communication, with globally similar question. And you can check playground e.g. - -

hopes this helps,

Check Processing. I did a small project related to that. A Processing code to read a file from the computer ( *.txt) send through a serial - USB into the Arduino and display a small text.

Here my tread :,76586.0.html and the Processing site :

Pay attention of the port number in Processing. Your computer system is not my computer system. And the baud speed has to match also.

You can type or copy a text file to a com port on a windows pc just using a simple batch file. You will need to write code for the arduino to receive your commands, but it won't be as simple as you appear to think it will be.

copy file.txt > comX

no batch file needed (assuming your on windows anyway)

no batch file needed (assuming your on windows anyway)

Well, assuming you are typing all the commands into the command processor. ;)


copy file.txt > comX

Let me need to be in console mode ? Right ? Like a MS-DOS command...

If your using processing that should be pretty easy, the arduino code could be simple too, how fast are the commands?