How do I stream data in real time from a QSerialPort external serial device and save is as a double?



  • This is how I set up the serial port:

    @
    QSerialPort serial;
    QByteArray value0;

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    serial.setPortName("COM3");
    serial.setBaudRate(QSerialPort::Baud9600);
    serial.setDataBits(QSerialPort::Data8);
    serial.setParity(QSerialPort::NoParity);
    serial.setStopBits(QSerialPort::OneStop);
    serial.setFlowControl(QSerialPort::NoFlowControl);
    serial.open(QIODevice::ReadWrite);
    }
    @

    but I'm not too sure where to go from here. Any help would be appreciated

    [edit: added missing coding tags @ SGaist]


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    This "example":http://qt-project.org/doc/qt-5/qtserialport-terminal-example.html might be a good start


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.