title: How to write on serial port using Qextserialport
body: <p>I am using Ubunt 10.10.</p>
  
  <p>I want to communicate with a microcontroller (ATmega328p) using serial through QT, so for testing I have created a dummy application on the microcontroller that reads character from the UART and responds on the serial port (replies) with the same character but in between brackets.</p>
  
  <p>If PC send: a   , then PC receives reply [a]</p>
  
  <p>The application is working great, when I am using hyper terminal (GtkTerm) to send the characters from PC, but when I use QT it does not work. I am sending from QT a character on the serial port, and I am waiting to receive a reply on the hyper terminal, but I do not get any reply.</p>
  
  <p>Serial Communication properties: Baud9600, Parity_none, Stop_bits_1, Data_8bits, Flow_control_Off</p>
  
  <pre><code>#include &lt;QtCore/QCoreApplication&gt;
  #include &lt;qextserialport.h&gt;
  
  int main(int argc, char *argv[])
  {
     QCoreApplication a(argc, argv);
  
     const char data[]= "e";
     QextSerialPort * port = new QextSerialPort("/dev/ttyUSB0");
  
     port-&gt;setBaudRate(BAUD9600);
     port-&gt;setFlowControl(FLOW_OFF);
     port-&gt;setParity(PAR_NONE);
     port-&gt;setDataBits(DATA_8);
     port-&gt;setStopBits(STOP_1);
     port-&gt;setTimeout(0);
     bool res = false;
     res = port-&gt;open(QIODevice::ReadWrite | QIODevice::Unbuffered);
  
     if(res)
     {
         qDebug("Opened");
         qDebug(data);
         int i = port-&gt;write(data, sizeof(data));
     }
     else
     {
         qDebug("Failed to connect");
     }
  
     return a.exec();
  }
  </code></pre>
  
  <p>Any idea what is wrong?</p>