Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

help.....serial port programming

I want to communicate with my serial port in python. I installed pyserial, and uspp for linux. Still, when I run the following code:

import serial

ser = serial.Serial('/dev/pts/1', 19200, timeout=1)

print ser.portstr #check which port was really used

ser.write("hello") #write a string

ser.close() #

it gives the following error:

Traceback (most recent call last): 
File "poi.py", line 5, in ser.open() 
File "/usr/local/lib/python2.6/dist-packages/pyserial-2.5-py2.6.egg/serial/serialposix.py", 

line 276, 
in open raise SerialException("could not open port %s: %s" % (self._port, msg)) serial.serialutil.SerialException: 
could not open port /dev/tyUSB1: [Errno 2] No such file or directory: '/dev/tyUSB1'

What should I do?

like image 356
user489712 Avatar asked Jun 23 '26 04:06

user489712


1 Answers

/dev/tyUSB1 looks like a typo. Device nodes are normally called /dev/ttyXXX

like image 69
Flexo Avatar answered Jun 24 '26 17:06

Flexo