Go Down

Topic: Read & Write Serial COM Port File to a Folder on PC (Read 1 time) previous topic - next topic

arfu34

Hey all,
i m new to this forum and i m an electronics student ..i m gng to use arduino uno in my final year project.
i want to if their is any way to write and read text file from serial monitor..
actually i want to write a txt file everytime my phone is tapped on reader so i want to do that in loop everytime phone is tapped txt file is created with the serial data coming on the com port ...and i m gng to send that txt file to a web server..
i worked with 8051 earlier and i m new to arduino plz help me...and suggest if any other method is easy for this task..
Thanks! :)

majenko

You can't do it "in the serial monitor".

However, you can do it either with your own software (it's just serial, after all) or with a different serial terminal emulator that offers logging to a file.

Most people around here seem to use C# for writing their own serial clients.

arfu34

can u send me a link for the thread of someone who wrote his own serial client using C#.?

majenko


can u send me a link for the thread of someone who wrote his own serial client using C#.?

No, I can't, because I don't know of any threads.  They exist though, but how they would help you I don't know.  Their project isn't your project.

If you want to use C# then maybe this would be a starting point: http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx

PeterH

The solution you describe seems a bit contrived to me (redirecting log messages to a text file and then posting the text file to a web server). If you want to log the events, it would IMO be more sensible to log them as they occur.

Anyway, the writing-to-local-text-file could be done by redirecting all the serial output to a text file using any of the common serial clients such as PuTTY or RealTerm. If you're on Windows, you could also use GoBetwino to read and write to text files and execute arbitrary commands. Whatever platform you're on, you can write your own PC application to receive messages from the serial port and log them however you want. (Writing them directly to a database would IMO be the most sensible starting point.)
I only provide help via the forum - please do not contact me for private consultancy.

PaulS

Quote
can u send me a link for the thread of someone who wrote his own serial client using C#.?

PM me with an e-mail address. I have a C# application that communicates with the Arduino.

majenko


Quote
can u send me a link for the thread of someone who wrote his own serial client using C#.?

PM me with an e-mail address. I have a C# application that communicates with the Arduino.

Now now, no signing him up to those naughty sites... What have we told you about that...  ]:D

arfu34


The solution you describe seems a bit contrived to me (redirecting log messages to a text file and then posting the text file to a web server). If you want to log the events, it would IMO be more sensible to log them as they occur.

Anyway, the writing-to-local-text-file could be done by redirecting all the serial output to a text file using any of the common serial clients such as PuTTY or RealTerm. If you're on Windows, you could also use GoBetwino to read and write to text files and execute arbitrary commands. Whatever platform you're on, you can write your own PC application to receive messages from the serial port and log them however you want. (Writing them directly to a database would IMO be the most sensible starting point.)


how should i write data directly to database?? i tried searching that but i didnt got any results so decided to post a text and opening that text file on server..
however i have thought to use ethernet shield and send data directly to server as i get from my Pn532

majenko

The usual way is to use the ethernet shield to post the data to a web page, which then inserts the data into the database.  You can then write the database side in whatever favourite web programming language you like.

K5CZ


actually i want to write a txt file everytime my phone is ...

Before you write and debug your own program to capture serial data, you may try this little trick:

-close IDE or close Serial Monitor
-download the program named Termite, install and configure it to communicate with your Arduino (COM port and speed)
-check and double click to the Plug-in "LogFile" (put filename)

Now you will grab incoming data to logfile you specified.
Arduino Uno R3, Arduino Mega 2560 R3, Ethermega (R3), and some Ethernet Shields (R3), Chronodots, TMP36 sensors, DS18B20 sensors, LCDs/TFTs, RS232C to learn and play...

PeterH


how should i write data directly to database??


The options depend on what type of connection you have between the Arduino and the host where the database runs. They also depend what operating system that host runs.
I only provide help via the forum - please do not contact me for private consultancy.

Go Up