QtSerialPort write() problems
-
I've been trying for a couple of days now, so I thought that I'd better get help from those that do a LOT more Qt dev than I. I'm using a USB to TTL Serial dongle, which I know works well, as outside of Qt, serial.Serial's write works very well.
For some reason inside of the bowels of Qt, serial.Serial doesn't exist. So, I thought that I'd switch to QtSerialPort and try again. I can get it to init the port, but writing to the port doesn't seem to want do anything for me. Scope doesn't see a thing at the Rx/Tx lines.
Am I just doing something stupid???
def openCover(self): global OpenTime msg_tx_buffer = bytearray([1, 1, 1, 31, 255]) op = self.openPort() if op: self.statusText.setText('Port opened') startTime = time.time() while time.time() < startTime + OpenTime: self.port.write(msg_tx_buffer) time.sleep(0.01) self.port.close()
-
@Moldy01 said in QtSerialPort write() problems:
For some reason inside of the bowels of Qt, serial.Serial doesn't exist
Don't know what this means, don't know what
serial.Serial
might be.Your code does not seem to use anything Qt, no
QSerialPort
class. Don't know whatself.openPort()
might or might not do. Don't know whatself.port
is.The only Qt code here is the
setText()
, which won't work anyway in the sense that it won't appear because you don't allow the Qt event loop to run.All your code seems maybe to use Python serial port handling/code, so look there for answers.