Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing to the serial port in Vista from Python

Tags:

python

windows

How do I write to the serial port in Vista from Python? The termios package only seem to support posix.

like image 834
Fylke Avatar asked Mar 12 '09 22:03

Fylke


2 Answers

pyserial does the trick, you'll need python extensions for windows for it to work in windows.

like image 95
Toni Ruža Avatar answered Sep 18 '22 19:09

Toni Ruža


Seems like it wasn't any harder than this using 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()
like image 44
Fylke Avatar answered Sep 19 '22 19:09

Fylke