从Python写入Vista中的串口

Fyl*_*lke 5 python windows

如何从Python写入Vista中的串口?termios包似乎只支持posix.

Ton*_*uža 9

pyserial做的伎俩,你需要Windows的python扩展,以便它在Windows中工作.


Fyl*_*lke 7

似乎使用pyserial并不比这更难:

import serial

ser = serial.Serial(0)  # open first serial port with 9600,8,N,1
print ser.portstr       # check which port was really used
ser.write('hello')
ser.close()
Run Code Online (Sandbox Code Playgroud)

  • @Robert P:我不同意,这更适合作为答案 (3认同)