1

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
Juraj
  • 3,490
  • 4
  • 18
  • 25
ecjb
  • 5,169
  • 12
  • 43
  • 79
  • `Ctrl-A Z` should show the help screen of minicom, or is it something else? – Fravadona Nov 19 '22 at 13:07
  • thank you for the comment @Fravadona. But this is the point: you are referring to GUI of minicom. I would like to have a more automated way of doing things and do everything from the command line (in a bash script) and not having to rely on `Ctrl-A Z` + some other commands – ecjb Nov 19 '22 at 13:11

1 Answers1

1

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 %
Fravadona
  • 13,917
  • 1
  • 23
  • 35
  • 1
    thanks a lot @Fravadona. That helps a lot. I upvoted your question (although I cannot accept it as I formulate the question with minicom). I am on mac OS and hat to change the `-F` in `-f` but it works fine. However the bash script seems to be hanging and I have to actively terminate the task with `Ctrl + c` while recording. Any idea why? – ecjb Nov 19 '22 at 14:24
  • 1
    @ecjb My bad, when the `sleep` completes the `cat` isn't affected because it doesn't read from stdin. I fixed my answer – Fravadona Nov 19 '22 at 18:03