Go Down

Topic: Need help about a communication function (Read 4461 times) previous topic - next topic


Hi, Im beginner about Arduino, I have a Boarduino, that's Duemilianove compatible, and do I need a function that creates a file in windows, with data previously stored in memory of ATMEGA. I don't have any idea of how to do this function...
The file created, could be a simple txt file. I believe this is not dificult to do, but Im on search for this for a week.

And also need, send this file to printer, and print it. =/

Someone can help me?



You need to run something like hyper terminal to take what is coming from the serial port of the arduino and dump it as a text file on the PC.

Otherwise you can write a program in some language like processing to do this.


Sep 24, 2009, 05:46 am Last Edit: Sep 24, 2009, 05:49 am by TBAr Reason: 1
You might be able to use Gobetwino, which, according to that link, can "Log data from Arduino to a file [on a Windows PC], with an optional timestamp."

Note, Gobetwino is not open source software (yet).

Hope this helps.


Really, I search this program (Gobetwino) and seems to be very interesting...

But anyone know, if I want that the Arduino send the order to print this file, I will need a protocol communication with the printer, or maybe needs to create a .bat file... or yet Gobetwino can make this?

thanks for help


Well, I've been watching some tutorials on C++, just to get a better handle of Functions, pointers, addressing.. still a bit confusing, but there are some good videos out there, take a look at this one, it's for Writing to a .txt file, keep in mind, this is in Visual Basic C++.

You'll need to implement reading from a Serial Connection, and print the data coming from the Serial connection, to the .txt file, which seems fairly easy. I haven't worked with C++ much, so I wasn't sure how to implement a library, which is required for the Serial communication (I believe?).

This guy has alot of decent C++ tutorials, everything you'll need to work with in the Arduino environment. :D
Best of luck, and do let us know how you get on!


Very good! This like to seems easy, Is that like this that I need. I have been research about and I think that is needs make a program in the computer write in VB, C++, Delphi, etc., and put only a protocol in Arduino controller (Firmata).

My problem is that I need:
- Reading the information printed, like in "serial monitor".
- Generate an log with this information.
- send instruction to the printer to print it.

If the best solution is create a program in the computer, this will out of thought, because my program are a little extensive...


I made some some testes with the Gobetwino and works fine but, when I send ctrl+p to print the log, the taskmanager open the "window of print" anda the Gobetwino can't control this window =/

Knows someone how to make an executable file in Windows, that on run it, only print a desired file?


or maybe needs to create a .bat file...

If you are using the term .bat instead of .cmd, that is a good sign. (That is a compliment from one old-timer to another.)

If you still use LPT1 to connect your printer, you can have Gobetwino run
  copy [file.txt] LPT1:
but I don't know how to print to a USB printer from the DOS command line.

The DOS print command also uses LPT1, I think, but you can take a look at that too.

Sorry I don't have a better answer for you right now.


TBAr, so need I to do a DOS program in C language, with this command that you mentioned? Need some library to make this? Or the Gobetwino accepts this code?

Otherwise... have another way to open a file (don't needs to create a log, only open) with the Arduino microcontroller? Because I need to See the information in serial monitor, and this isn't possible in same time while run the Gobetwino.


Ok, with the changed requirement to see the data in the serial monitor instead of creating a file on Windows, it's time for you to learn how to communicate with a program on the PC, I think. You talked about Firmata before, that seems like a good solution. So study the information at http://arduino.cc/en/Reference/Firmata and see what that can do for you.


I'm almost find the solution, I make a program in Processing, that read and send data for serial port, and creates the file that I need... I'm only don't know a function to send a file to the printer =/
If someone tell me a function in C or java for example, I can make a program, and call this executable in processing...


Sep 30, 2009, 02:41 pm Last Edit: Sep 30, 2009, 02:43 pm by TBAr Reason: 1
You could always use the following pseudo-code:

   open the file for reading
   read each line and print it, using printf()
   close the file

You shouldn't need anything more than that, should you?


No my friend, I need to send the file to the Printer, and print it in the Printer, not in the monitor...


I found!

I only wrote in notepad

Code: [Select]
@echo off

type "C:\...\filename.txt" > "LPT1"

without quotes,
and save as .bat

after, I call this saved file in my program write in processing at moment that I need.

Is simpler than I thought...

Thanks for help!

Go Up