简体   繁体   中英

testing usb to serial to usb using pyserial has no output

I'm trying to test writing messages to serial port using pyserial and reading it again using two usb to serial adapters connected back to vack "USB-Serial --> Serial-USB" to verify it is writing to the serial port as it is meant for communication with hardware, so I have open console witch is reading all the time

import serial

port = 'COM6'
read_ser = serial.Serial(port)

while True:
  x=read_ser.read()
  print(x)

and for writing I use

import serial

port = 'COM5'
ser = serial.Serial(port)
# ser.write(str.encode('$GPRMC,081117.24,A,5042.988302,N,1058.376556,E,14.7,,230813,0.0,E*74'))
ser.write('$GPRMC,081117.24,A,5042.988302,N,1058.376556,E,14.7,,230813,0.0,E*74'.encode())

And nothing is shown in the reading console I tried both adapters and read from external serial hardware successfully.

I'm using python 3.7 on windows 10

我想通了问题出在引脚布局上,因为我使用性别转换器使用串行电缆连接两个串行适配器,而不是解决了问题。

Which serial cable do you use? Direct serial cable or cross serial cable? May you give its circuit diagram?

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