A
A
AlexSer2018-05-30 19:18:03
Python
AlexSer, 2018-05-30 19:18:03

How to get data from serial port?

Guys tell me how to get the data
here is the code

import serial
ser=serial.Serial(port='COM1', baudrate=9600)
while True :
  line = ser.readline()
  print (line)

I'm trying to emulate data on a com port from the COM PORT DATA EMULATOR program.
But if I run the script at the beginning, then the emulator swears that the port is already busy, if I start the emulator, then the script swears. What should be added?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pfg21, 2018-05-30
@AlexSer

no paluchitz :) com-port one and two connections to it can not be.
connection from the "back side" of the com port, what you are trying to do is to write your own driver, which will register a virtual com port into the system and work as you need.
do not rosin brains and put https://sourceforge.net/projects/com0com/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question