Automate the opening recording and closing a text file for serial data with minicom (and arduino)

252 Views Asked by At

I am using an arduino and save the output with minicom but want to automate the process for opening recording and closing the text file.

I am currently using the following: first I give the following command in the terminal:

$ minicom -D /dev/cu.usbserial-1420 -b 115200

Then for the opening recording and closing of the text file: have to do the following:

  • Press Ctrl A + Z
  • Press Shift + L for start recording
  • Waiting for writing output
  • Press Shift + L for stop recording
  • Check file minicom.cap – it’s a text file and you can open using any text editor

which is a bit cumbersome

Instead what I want to do is to write a bash script (.sh or .zsh) which would look like this:

# Command number 1 to be implemented which open a text file and start writing the output
sleep 2 #(peforms the recording during 2 seconds)
# Command number 2 to be implemented which stops the writing and close the file
1

There are 1 best solutions below

2
On

minicom doesn't seem easy to automate. If you only use it for setting the baud rate and recording the output during 2 seconds then you might replace it with something like:

stty -F /dev/cu.usbserial-1420 115200

cat /dev/cu.usbserial-1420 > output.cap &

sleep 2

kill %