Curitiba PR, Brazil
Offline
Full Member
Karma: 0
Posts: 208
Arduino rocks
|
 |
« on: September 23, 2009, 01:34:53 pm » |
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?
Thanks
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25569
Solder is electric glue
|
 |
« Reply #1 on: September 23, 2009, 02:32:19 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 0
Posts: 388
|
 |
« Reply #2 on: September 23, 2009, 10:46:32 pm » |
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.
|
|
|
|
« Last Edit: September 23, 2009, 10:49:26 pm by TBAr »
|
Logged
|
|
|
|
|
Curitiba PR, Brazil
Offline
Full Member
Karma: 0
Posts: 208
Arduino rocks
|
 |
« Reply #3 on: September 24, 2009, 07:30:28 am » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Spokane, Washington
Offline
God Member
Karma: 0
Posts: 686
My name is Bob, and I'm an addict.
|
 |
« Reply #4 on: September 24, 2009, 02:08:26 pm » |
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.  Best of luck, and do let us know how you get on!
|
|
|
|
|
Logged
|
|
|
|
|
Curitiba PR, Brazil
Offline
Full Member
Karma: 0
Posts: 208
Arduino rocks
|
 |
« Reply #5 on: September 25, 2009, 07:33:48 am » |
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...
|
|
|
|
|
Logged
|
|
|
|
|
Curitiba PR, Brazil
Offline
Full Member
Karma: 0
Posts: 208
Arduino rocks
|
 |
« Reply #6 on: September 25, 2009, 01:22:40 pm » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 0
Posts: 388
|
 |
« Reply #7 on: September 26, 2009, 12:31:10 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Curitiba PR, Brazil
Offline
Full Member
Karma: 0
Posts: 208
Arduino rocks
|
 |
« Reply #8 on: September 28, 2009, 11:24:25 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 0
Posts: 388
|
 |
« Reply #9 on: September 28, 2009, 07:38:09 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Curitiba PR, Brazil
Offline
Full Member
Karma: 0
Posts: 208
Arduino rocks
|
 |
« Reply #10 on: September 29, 2009, 09:46:34 am » |
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...
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 0
Posts: 388
|
 |
« Reply #11 on: September 30, 2009, 07:41:44 am » |
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?
|
|
|
|
« Last Edit: September 30, 2009, 07:43:31 am by TBAr »
|
Logged
|
|
|
|
|
Curitiba PR, Brazil
Offline
Full Member
Karma: 0
Posts: 208
Arduino rocks
|
 |
« Reply #12 on: September 30, 2009, 11:23:17 am » |
No my friend, I need to send the file to the Printer, and print it in the Printer, not in the monitor...
|
|
|
|
|
Logged
|
|
|
|
|
Curitiba PR, Brazil
Offline
Full Member
Karma: 0
Posts: 208
Arduino rocks
|
 |
« Reply #13 on: October 01, 2009, 12:16:29 pm » |
I found! I only wrote in notepad @echo off
cls 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!
|
|
|
|
|
Logged
|
|
|
|
|
|