使用minicom(和arduino)自动打开记录和关闭串行数据的文本文件



我使用arduino并使用minicom保存输出,但希望自动打开记录和关闭文本文件的过程。

我目前正在使用以下命令:首先,我在终端中给出以下命令:

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

那么对于文本文件的打开录制和关闭:必须执行以下操作:

  • 按Ctrl A + Z
  • 按Shift + L开始录制
  • 等待写输出
  • 按Shift + L停止录制
  • 检查文件minicom。这是一个文本文件,你可以使用任何文本编辑器打开

有点麻烦

相反,我想写一个bash脚本(.sh或.zsh),看起来像这样:
# 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

minicom似乎不容易实现自动化。如果你只使用它来设置波特率并在2秒内记录输出,那么你可以将其替换为以下内容:

stty -F /dev/cu.usbserial-1420 115200
cat /dev/cu.usbserial-1420 > output.cap &
sleep 2
kill %

最新更新