
Originally Posted by
wysota
As far as I remember bytesAvailable() doesn't work with QExtSerialPort.
supposed that bytesAvailable() doesn't work ,i amend my code as:
RS232->writeData(Data,13); //write data
usleep(120000); //wait
int i= RS232->QIODevice::bytesAvailable();//if there are bytes availble to read
str.setNum(i);
Com->setText(str);//show the bytes availble to read on the 'Com' Button
char *pStr=NULL;
RS232->read(pStr,13); //read data from serial port to pStr
Com1->setText(pStr); //show the data on 'Com1' Button
RS232->close();
RS232->writeData(Data,13); //write data
usleep(120000); //wait
int i= RS232->QIODevice::bytesAvailable();//if there are bytes availble to read
QString str;
str.setNum(i);
Com->setText(str);//show the bytes availble to read on the 'Com' Button
char *pStr=NULL;
RS232->read(pStr,13); //read data from serial port to pStr
Com1->setText(pStr); //show the data on 'Com1' Button
RS232->close();
To copy to clipboard, switch view to plain text mode
i still can't get any data! why?
to zeratul: i don't use the serial monitor.
Bookmarks