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
2
  • Ctrl-A Z should show the help screen of minicom, or is it something else?
    – Fravadona
    Commented Nov 19, 2022 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
    Commented Nov 19, 2022 at 13:11

1 Answer 1

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 %
2
  • 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
    Commented Nov 19, 2022 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
    Commented Nov 19, 2022 at 18:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.