Last active
October 3, 2017 12:53
-
-
Save dvsseed/a9ca5b915be0684097dfed07b4898ac3 to your computer and use it in GitHub Desktop.
To detect the serial ports on windows 10 laptop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding:utf-8 | |
""" | |
Written on a Windows 10 Laptop, Python 2.7.14 Version. | |
This program automatically detects and lists ports. | |
Written by Davis, Tseng 10/03/2017. | |
""" | |
# import serial | |
import serial.tools.list_ports | |
# Find Live Ports | |
ports = list(serial.tools.list_ports.comports()) | |
# If not found on serial | |
if not ports: | |
print u"連接埠(COM) not found!" | |
# If found | |
for p in ports: | |
print p # This causes each port's information to be printed out. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment