Author Topic: how to save serial monitor in the text file?  (Read 8990 times)

0 Members and 1 Guest are viewing this topic.

Offline NateDuongTopic starter

  • Contributor
  • Posts: 16
how to save serial monitor in the text file?
« on: September 04, 2015, 08:50:42 pm »
 Dear everyone,

I trying to  save serial monitor in the text file, but I still do not know how, could you please help on this problem?

Here is the codes with random numbers are set up, and I would like you save all data into the text file,

Thank you very much,

Best regards,

Nate Duong,


long Channel1a;long Channel1b;
long Channel2a;long Channel2b;
long Channel3a;long Channel3b;

long Channel4a;long Channel4b;

int count1 = 0;
int count2 = 0;
int n1 = 1000        +1;  //  +1 is missing count
int n2 = 2         +1;

void setup(){
  Serial.begin(9600);
  randomSeed(analogRead(0));
}

void loop(){


while(count2<=n2){
  //Serial.print("nate1\n");
   while(count1<=n1){
     if ((count1==2)|(count1==1)){
               Serial.print("     Q1     I1     Q2     I2     Q3     I3     Q4     I4 \n");  // print out the channels
                   }
     Channel1a = random(300); Channel1b = random(300);
     Channel2a = random(300); Channel2b = random(300);
     Channel3a = random(300); Channel3b = random(300);
     Channel4a = random(300); Channel4b = random(300);
   
     Serial.print("    "); Serial.print(Channel1a); Serial.print("    ");
     Serial.print(Channel1b); Serial.print("    ");
     Serial.print(Channel2a); Serial.print("    ");
     Serial.print(Channel2b); Serial.print("    ");
     Serial.print(Channel3a); Serial.print("    ");
     Serial.print(Channel3b); Serial.print("    ");
     Serial.print(Channel4a); Serial.print("    ");
     Serial.print(Channel4b); Serial.print("    \n");
     count1 = count1 +1;
     delay(500);
                      }
                 }
     count2 = count2  +1;
     Serial.print(" \n");}
 

exapod

  • Guest
Re: how to save serial monitor in the text file?
« Reply #1 on: September 04, 2015, 10:47:05 pm »
I use putty as my serial terminal on the pc and there is an option to log all the data in a text file.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: how to save serial monitor in the text file?
« Reply #2 on: September 05, 2015, 12:59:22 am »
The Arduino Serial Monitor, like the reset of the Arduino IDE, is quite primitive.  If your data is too big to Copy and Paste (into a text editor) all at once, then there is no way to use it to do what you want.  Fortunately, there is nothing special or proprietary about the Arduino Serial Monitor, and you can simply use another "Terminal Emulator" or Serial Communication Tool.

I also use putty on windows, and I use minicom on MacOS and Linux.
 

Offline Morgoroth

  • Regular Contributor
  • *
  • Posts: 123
  • Country: cl
Re: how to save serial monitor in the text file?
« Reply #3 on: September 05, 2015, 03:30:17 am »
RealTerm and TeraTerm are very good doing that, however, you can easily program your own application for that, search "boost serial port" on google and you will founs a bunch of working examples.
----------------------------------------------------------
If works, doesn't means it is right.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: how to save serial monitor in the text file?
« Reply #4 on: September 05, 2015, 06:11:11 pm »
Yes. It's too easy to write yourself. It just takes a few days of your life.
Use mine:
https://github.com/Jeroen6/MultiTerminal
(it does not actually dump it into a file continuously, plenty of logger tools around for that. It can however split your channels realtime)
« Last Edit: September 05, 2015, 06:13:29 pm by Jeroen3 »
 

Offline jimdeane

  • Regular Contributor
  • *
  • Posts: 128
  • Country: us
Re: how to save serial monitor in the text file?
« Reply #5 on: September 21, 2015, 03:17:27 am »
On Linux I use the SCREEN program. It allows you to connect to serial devices, create multiple sessions, and take screenshots or run continuous logging.

I use it to collect muon detector data for days or weeks at a time. Gigs of data. Works great.
 

Offline JacquesBBB

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: fr
Re: how to save serial monitor in the text file?
« Reply #6 on: September 21, 2015, 08:05:25 am »
On a Unix machine or a Mac OsX, it can be done in a single line  of shell

nohup cat /dev/cu.usbmodem1d11 > temp.log &


replace  "/dev/cu.usbmodem1d11" by the port you are sending data to
and "temp.log" by the name  the file you want to store data in.

 

Offline mauroh

  • Frequent Contributor
  • **
  • Posts: 292
  • Country: it
    • Mauro Pintus
Re: how to save serial monitor in the text file?
« Reply #7 on: September 21, 2015, 09:57:07 am »
If you need to capture all the serial events on a txt file with an Arduino without the PC you can do it on a SD card.

Take a look here


Or you can search for Arduino datalogger, it is pretty straight forward.

Mauro

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7369
  • Country: nl
  • Current job: ATEX product design
Re: how to save serial monitor in the text file?
« Reply #8 on: September 21, 2015, 02:19:40 pm »
Meh. Probably I'm getting old, but I would do it with a batch file. Or just type it to cmd.exe
mode COM1 BAUD=115200 PARITY=n DATA=8
TYPE COM1 data.txt
 

Offline NateDuongTopic starter

  • Contributor
  • Posts: 16
Re: how to save serial monitor in the text file?
« Reply #9 on: September 23, 2015, 12:24:17 pm »
Dear all,

Thank you so much for your recommendations,

But the best way I tried with Batch file,

It really worked.

Thanks again.

Best regards,

Nate Duong.
 

Offline Rick Law

  • Super Contributor
  • ***
  • Posts: 3439
  • Country: us
Re: how to save serial monitor in the text file?
« Reply #10 on: September 27, 2015, 04:29:16 am »
For generic text capturing, Teraterm works rather nicely.

If data parsing or other feature is needed, a quick Java program is a good choice too since the Arduino IDE environment already have all the Java classes needed to talk to the Arduino.
 

Offline dentaku

  • Frequent Contributor
  • **
  • Posts: 881
  • Country: ca
Re: how to save serial monitor in the text file?
« Reply #11 on: September 27, 2015, 12:03:06 pm »
Meh. Probably I'm getting old, but I would do it with a batch file. Or just type it to cmd.exe
mode COM1 BAUD=115200 PARITY=n DATA=8
TYPE COM1 data.txt

That might come in handy some day.  :-+
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf