
Ser.write(b'serail port on wsl \n') # write a string Print(ser.name) # check which port was really used
Python serial port example windows serial#
Ser = serial.Serial('/dev/ttyS3') # open serial port mkdir wsl-python-spĬopy following code into hello.py import serial You can get the COM port number from device manager window.

Any existing python program should work if we just change the serial port name to `/dev/ttyS`, where N is the COM port number. We will use pySerial to connect with serial port.
