Go Down

Topic: Can Arduino write to a text file? (Read 28 times) previous topic - next topic

tkbyd

I don't know Macs well, but would be VERY surprised if they don't have some Hyperterminal-like program (HLP).

That could be "fired up", connected to the Arduino (and the Arduino connected to the Mac) and then the HLP would put up on the Mac screen the stuff coming from the Arduino. From time to time, the human could save what had been sent to the Mac since the last save.

Of course, this entails a human being at the keyboard, but if that's not impossible, it saves you a bunch of issues.

Some Mac person: Please jump in with the name of the Mac equivalent of Hyperterminal?

===
Another issue: There are various ways to connect two computers. If you can endure a "crude" solution, you will have less hassle. By crude, I'm meaning a non-handshaked solution in which the Arduino "talks" without taking any notice of whether anyone is listening.

Jonathan Foerster

tkbyrd asked for a Mac equivalent to HyperTerminal.  That would be Terminal (found in /Applications/Utilities/).

Now to jcole:

You will, of course, need to tell the Arduino to print something to serial.  There's a lot out there on doing that.

But...

If what you want to do is simply write serial data from the Arduino to a text file you can do this very simply by entering the following command in a Terminal window:
cat /dev/cu.usbserial-(there is a string here that will vary from device to device) > /path/to/filename.txt

This command will run until you tell it to stop, so watch out, your log file will get big quick.

Google arduino-serial.c for some great blog posts.

Be sure to read the comments.

es111

It looks like i've the same problem, but still can't find simple solution.

I need to use some data from arduino in VB - should i write it on Eprom, than load it (how in VB) ?, or should i send it on PC some other way (f.e with processing) ?

What do You suggest ? (I'm quite newbie with arduino, so excuse me :))

thanks in advice for your help.

florinc

On the receiver (PC) side, in VB, you can use a class that deals with the serial port. An instance of that class will wait for data on the specified serial port, then read it in.
On the sender (arduino) side, your sketch will send out data on the serial port, using Serial.print.

No need for eprom, processing etc.

This is the case when you want to write your own, specific, code. Otherwise, if you just want to get/read/record the data coming from arduino on your PC, there are many solutions: GoBetwino, Processing, Arduino IDE, VB scripts etc.


mattkime

>>cat /dev/cu.usbserial-(there is a string here that will vary from device to device) > /path/to/filename.txt

I'm trying to save the data from a serial port on my mac to a text file and this command doesn't work and worse seems to leave the serial port in an odd state which requires a restart.

i have no problem using screen to view the incoming data so i know its there but i'm at a loss as to why i can't find a good command to save it to a text file.

suggestions/advice?

Go Up