views:

39

answers:

0

I'm trying to make a serial connection to an Arduino Diecimila board with QextSerialPort. My application hangs though everytime I call port->open(). The reason I think this is happening is because the Arduino board resets itself everytime a serial connection to it is made. There's a way of not making the board reset described here, but I can't figure out how to get QextSerialPort to do that. I can only set the DTR to false after the port has been opened that's not much help since the board has already reset itself by that time.

The code for the connection looks like this:

 port = new QextSerialPort("/dev/tty.usbserial-A4001uwj");
 port->open(QIODevice::ReadWrite);
 port->setBaudRate(BAUD9600);   
 port->setFlowControl(FLOW_OFF);
 port->setParity(PAR_NONE);    
 port->setDataBits(DATA_8);   
 port->setStopBits(STOP_1);
 port->setDtr(false);
 port->setRts(false);

Any ideas on how to get this done. I don't necessarily need to use QextSerialPort should someone know of another library that does the trick.

I'm new to C++ and Qt.

UPDATE: I noticed that if I run a python script that connects to the same port (using pySerial) before running the above code, everything works just fine.