Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. How to Store Multiple data using Serialport in QT
Forum Updated to NodeBB v4.3 + New Features

How to Store Multiple data using Serialport in QT

Scheduled Pinned Locked Moved Unsolved Qt WebKit
2 Posts 2 Posters 618 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hemalatha Gajula
    wrote on last edited by
    #1

    void MainWindow::readData() // CH1 and CH2 Data Logic implementation
    {

    // int r1,r2,r3,r4 = 0;
    //int m,n,x,y = 0;
    // int num3, num4 = 0;
    // QByteArray RX_Data[6] = {0,0,0,0,0,0};
    QByteArray UART_Data[5] = {0,0,0,0,0};
    int k;
    QByteArray data;

     for(k=0; k<5; k++)
     {
         data= serialPort->readAll();
         ui->plainTextEdit_3->insertPlainText(data);
         UART_Data[k] = data;
         ui->plainTextEdit_2->insertPlainText(UART_Data[k]);
     }
    

    // for(k=3; k<5; k++)
    // {
    // ui->plainTextEdit_3->insertPlainText(UART_Data[k]);
    // }

    // ui->plainTextEdit_3->insertPlainText(UART_Data[4]);

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      That code won't work as QSerialPort is asynchronous by default.

      What is your end goal ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved