Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How we can read particular string/data from any device to print on particular LCD in qt?
Forum Updated to NodeBB v4.3 + New Features

How we can read particular string/data from any device to print on particular LCD in qt?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
qtcreatorqtwidgetsqt5.5qt4read serial
25 Posts 5 Posters 10.6k Views 2 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.
  • S Offline
    S Offline
    SGaist
    Lifetime Qt Champion
    wrote on 27 Mar 2018, 11:21 last edited by
    #21

    @Mohit-Tripathi said in How we can read particular string/data from any device to print on particular LCD in qt?:

    void Dialog::updateLCD(QString sensor_reading)
    {
    ui->temp_lcdNumber_2->display(sensor_reading);
    ui->temp_lcdNumber_3->display(sensor_reading);
    }

    As already explained several times: you are updating both temp_lcdNumber_2 and temp_lcdNumber_3 with the same value each time you call that function.

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

    M 1 Reply Last reply 27 Mar 2018, 11:35
    2
    • S SGaist
      27 Mar 2018, 11:21

      @Mohit-Tripathi said in How we can read particular string/data from any device to print on particular LCD in qt?:

      void Dialog::updateLCD(QString sensor_reading)
      {
      ui->temp_lcdNumber_2->display(sensor_reading);
      ui->temp_lcdNumber_3->display(sensor_reading);
      }

      As already explained several times: you are updating both temp_lcdNumber_2 and temp_lcdNumber_3 with the same value each time you call that function.

      M Offline
      M Offline
      Mohit Tripathi
      wrote on 27 Mar 2018, 11:35 last edited by Mohit Tripathi
      #22

      @SGaist
      As per discussion above, I have defined that if I make two functions, I get both write values on one LCD. But, if I define one function :

      void Dialog::updateLCD(QString sensor_reading)
      {
      ui->temp_lcdNumber_2->display(sensor_reading);
      ui->temp_lcdNumber_3->display(sensor_reading);
      }
      

      I get the same value on both LCD.

      But, my question was "how can I get the one input in one only LCD if we have multiple LCD widget?". I have mentioned in my comment as well as question.
      I have used two different functions, same functions and two arrays also. Please go through my recent code in above comment.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 27 Mar 2018, 18:57 last edited by
        #23

        That's simple and what @J-Hilk showed in his example. Properly parse the data you receive and update each LCD separately.

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

        M 1 Reply Last reply 28 Mar 2018, 10:41
        2
        • S SGaist
          27 Mar 2018, 18:57

          That's simple and what @J-Hilk showed in his example. Properly parse the data you receive and update each LCD separately.

          M Offline
          M Offline
          Mohit Tripathi
          wrote on 28 Mar 2018, 10:41 last edited by Mohit Tripathi
          #24

          @SGaist @jsulm @J-Hilk @Global-Moderators @Moderators @J.Hilk
          Is this a right way to write the data of two textEdit using pushbutton. I think that I am storing both values in one string that's why I am getting the both values on one LCD widget.

          void Dialog::on_pushButton_clicked()
          {
              QString output1 = ui->lineEdit->text();
            //  qDebug()<<output1;
              QString output2 = ui->lineEdit_2->text();
             // qDebug()<<output2;
              if(arduino->isWritable())
              {
                   arduino->write(output1.toStdString().c_str());
                  arduino->flush();
                   arduino->waitForBytesWritten(500);
                   arduino->write(output2.toStdString().c_str());
                   arduino->flush();
                   arduino->waitForBytesWritten(500);
                   qDebug()<<output1;
                   qDebug()<<output2;
              }
          }
          
          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 28 Mar 2018, 19:40 last edited by
            #25

            Don't @ the moderators unless you have an issue requiring moderation.

            Depending on the content of your line edit, you can use toLatin1() or toUtf8() rather than making these two conversions.

            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
            2

            21/25

            27 Mar 2018, 11:21

            • Login

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