Python Forum
Using USB - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Using USB (/thread-10513.html)



Using USB - KenHorse - May-23-2018

So I have a USB to serial converter on /dev/ttyUSB0 and try writing to it but nothing happens:

#!/usr/bin/python


import serial
import sys

# Set Port
ser = serial.Serial('/dev/ttyUSB0', 57600, 8, 'N', 1, timeout=1)

ser.open()   # Reopen the port.

reset = "Hello World"
ser.write(reset)

time.sleep(.5)

print 'serial closed'
ser.close()
What am I doing wrong?