I'm trying to write a program that reads from a serial port and writes to a file. But I can't make pySerial work.
"import serial" at the start of the program triggers no errors despite the fact that the file serial.py is not in the directory. Shouldn't it?
Line two of the introduction (can't post link, sorry) however triggers an error:
"import serial" at the start of the program triggers no errors despite the fact that the file serial.py is not in the directory. Shouldn't it?
Line two of the introduction (can't post link, sorry) however triggers an error:
>>> import serial >>> ser = serial.Serial('/dev/ttyUSB0') # open serial port
Error:Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\steen\AppData\Local\Programs\Python\Python36-32\lib\site-packag
es\serial\serialwin32.py", line 31, in __init__
super(Serial, self).__init__(*args, **kwargs)
File "C:\Users\steen\AppData\Local\Programs\Python\Python36-32\lib\site-packag
es\serial\serialutil.py", line 240, in __init__
self.open()
File "C:\Users\steen\AppData\Local\Programs\Python\Python36-32\lib\site-packag
es\serial\serialwin32.py", line 62, in open
raise SerialException("could not open port {!r}: {!r}".format(self.portstr,
ctypes.WinError()))
serial.serialutil.SerialException: could not open port '/dev/ttyUSB0': FileNotFo
undError(2, 'Den angivne sti blev ikke fundet.', None, 3)
>>>
If I can't even make the introduction work, I don't know what to do. Any help would be greatly appreciated :-)Moderator Larz60+: Added error tags.