How to Read Data from Serial Port in R

前端 未结 2 1829
攒了一身酷
攒了一身酷 2021-02-02 03:43

I\'m wanting to plot live data from the serial port. I figured R would be a good tool for the job. I\'m stumbling on trying to read data from the serial port (COM4). I\'ve ve

相关标签:
2条回答
  • 2021-02-02 04:19

    Teraterm and Windows use a different mechanism to configure serial devices. Are your system connection settings ok compared to what is configured in teraterm? Re-check the configuration parameter in teraterm and then use them to set your COM4: configuration in R.

    system("mode COM4: BAUD=115200 PARITY=N DATA=8 STOP=1")

    see mode /? on your command prompt for further parameters

    it might also be helpful to read data character by character using readChar()

    It sometimes happens that teraterm doesn't close RS232 connections properly.

    0 讨论(0)
  • 2021-02-02 04:20

    i am working with the serial-package (here) available on CRAN. This was developed to do exactly that what you need. Reading and sending data form and to RS232 etc. connections. I do really recommend this, because "mode.exe" seems not to work for virtual COM-ports. See NPort-Server etc.

    0 讨论(0)
提交回复
热议问题