简体   繁体   中英

How to connect to port using pyserial?

I tried to connect to CashCode VAULT1500 Bill Validator.
I'd connected it to Windows machine and working in Debian VmBox virtual machine. There how i connect COM port with CashCode into VMBox :

VMBox屏幕截图

On debian i check port name:

python -m serial.tools.list_ports

Got:

/dev/ttyS3

Now i tried to connect to port like in example https://github.com/ubombi/cashcode_ccnet/tree/master/ccnet :

import serial
ser = serial.Serial(port='/dev/ttyS3', baudrate=9600, timeout=None,bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE)
t = ser.read(3)

But no answer here.
What can i miss on VMBox settings or code?

Why don't you use the COM port name directly?

ser = serial.Serial('COM4')
print(ser.name)
ser.read(3)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM