Read and Write in PC

Hi everybody!

I'm new in the Arduino world, and have trouble with a personnal project... My goal is to use my Arduino as a Datalogger, with different sensor.

I would like that my Arduino Mega produce a .txt file in my computer (not a SD card) during processing. I already find 100 of topics about reading or writting by Arduino. But i didn't find anything that helps me...

I'm coding in C++/C and nothing I had tried works..! :( Print in terminal works well. For example I turn ON a led, than turn it off and print "Work goes well" in the "Serial Monitor", just the "file step" missing.

If someone can send me a small code extract that does it well, it would perfect!

Thanks a lot everybody! :D

Look into the Processing program language processing.org . You can send your data to a Processing program via serial port and save the data to a file pretty easily. In any case you will have to have some program on the PC to read the serial port and save to file.

You have tons of options,

Writing code on:

C/C++ Java Python (recommended if using Linux) Proccesing

And then import the serial rs232 library.

But I think coding in Proccesing may be easier, well it depends on how comfortable you feel with each language.

This demo shows communication with an Arduino using Python. The code is serial input basics may also be useful.

Don't expect the Mega to produce a text file. Just get it to send data to a PC program that then creates the file and writes the data in whatever format you want.

Another crude option is for the Mega to send data to a terminal program such as puTTY which can save the data it receives into a file.

...R