PySerial [Error 5] Access is Denied

前端 未结 5 2018
不思量自难忘°
不思量自难忘° 2021-01-05 08:40

I am trying to write a program in Python that will loop to keep checking the serial port (COM4) and print out a message when the character \"1\" is read from the serial port

5条回答
  •  感动是毒
    2021-01-05 09:03

    Please, take care with the python versions.

    From the pyserial manual about: class serial.Serial https://pyserial.readthedocs.io/en/latest/pyserial_api.html#classes

    ...........

    The port is immediately opened on object creation, when a port is given. It is not opened when port is None and a successive call to open() is required.

    port is a device name: depending on operating system. e.g. /dev/ttyUSB0 on GNU/Linux or COM3 on Windows.

    ............

    Changed in version 3.0: numbers as port argument are no longer supported

提交回复
热议问题