自动识别现接serial端口名称

2015-06-14 0 618
自动识别现接serial端口名称
#!/usr/bin/env python
# -*- coding: utf-8 -*

import serial
import serial.tools.list_ports

port_list = list(serial.tools.list_ports.comports())

if len(port_list) <= 0:
	print "The Serial port can't find!"
	
else:
    port_list_0 =list(port_list[0])

	port_serial = port_list_0[0]

	ser = serial.Serial(port_serial,9600,timeout = 60)

	print "check which port was really used >",ser.name

遇见资源网 python 自动识别现接serial端口名称 http://www.ox520.com/15514.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务