Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Cannot output a value using QSerialPort
Forum Updated to NodeBB v4.3 + New Features

Cannot output a value using QSerialPort

Scheduled Pinned Locked Moved Unsolved General and Desktop
55 Posts 8 Posters 4.6k Views 4 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.
  • M Offline
    M Offline
    mrjj
    Lifetime Qt Champion
    wrote on 22 Mar 2020, 08:42 last edited by mrjj
    #44

    Hi

    Some notes

    You call setBaudRate, setDataBits etc AFTER you open port. that is wrong.
    must be before open!
    All of them. Open goes last.
    Actually you can :)

    You do not check if
    arduino->open(QSerialPort::ReadOnly);
    fails.
    like
    if ( ! arduino->open(QSerialPort::ReadOnly) ) {
    QMessageBox::information(this,...report error);
    return;
    }
    see @jsulm post !

    So does it ever enter into void Dialog::readSerial() ?

    1 Reply Last reply
    2
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 22 Mar 2020, 08:57 last edited by
      #45

      @mrjj said in Cannot output a value using QSerialPort:

      You call setBaudRate, setDataBits etc AFTER you open port. that is wrong.

      I already said this some days ago: https://forum.qt.io/topic/112346/cannot-output-a-value-using-qserialport/23 but it is simply ignored...

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      M 1 Reply Last reply 22 Mar 2020, 09:10
      2
      • C Christian Ehrlicher
        22 Mar 2020, 08:57

        @mrjj said in Cannot output a value using QSerialPort:

        You call setBaudRate, setDataBits etc AFTER you open port. that is wrong.

        I already said this some days ago: https://forum.qt.io/topic/112346/cannot-output-a-value-using-qserialport/23 but it is simply ignored...

        M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 22 Mar 2020, 09:10 last edited by
        #46

        @Christian-Ehrlicher
        Indeed and also @jsulm also noted to check open which seems to be forgotten also.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kuzulis
          Qt Champions 2020
          wrote on 22 Mar 2020, 18:43 last edited by
          #47

          @mrjj said in Cannot output a value using QSerialPort:

          You call setBaudRate, setDataBits etc AFTER you open port. that is wrong.
          must be before open!

          This is not true. You can configure QSP in any time.

          M P 2 Replies Last reply 22 Mar 2020, 19:00
          1
          • K kuzulis
            22 Mar 2020, 18:43

            @mrjj said in Cannot output a value using QSerialPort:

            You call setBaudRate, setDataBits etc AFTER you open port. that is wrong.
            must be before open!

            This is not true. You can configure QSP in any time.

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 22 Mar 2020, 19:00 last edited by
            #48

            @kuzulis
            Ok
            thank you for clarifying that.
            Over the years I have not had huge success with that without close and reopen the port but its
            good to know QSerialPort does support it :)

            1 Reply Last reply
            0
            • K kuzulis
              22 Mar 2020, 18:43

              @mrjj said in Cannot output a value using QSerialPort:

              You call setBaudRate, setDataBits etc AFTER you open port. that is wrong.
              must be before open!

              This is not true. You can configure QSP in any time.

              P Offline
              P Offline
              Pablo J. Rogina
              wrote on 22 Mar 2020, 19:01 last edited by
              #49

              @kuzulis said in Cannot output a value using QSerialPort:

              This is not true. You can configure QSP in any time.

              Are you saying that you can change the settings once a connection has been established?

              Upvote the answer(s) that helped you solve the issue
              Use "Topic Tools" button to mark your post as Solved
              Add screenshots via postimage.org
              Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

              M 1 Reply Last reply 22 Mar 2020, 19:10
              0
              • P Pablo J. Rogina
                22 Mar 2020, 19:01

                @kuzulis said in Cannot output a value using QSerialPort:

                This is not true. You can configure QSP in any time.

                Are you saying that you can change the settings once a connection has been established?

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 22 Mar 2020, 19:10 last edited by
                #50

                @Pablo-J-Rogina

                Yes seems so and he should know as he wrote it :)

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  kuzulis
                  Qt Champions 2020
                  wrote on 23 Mar 2020, 06:10 last edited by
                  #51

                  @Pablo-J-Rogina said in Cannot output a value using QSerialPort:

                  Are you saying that you can change the settings once a connection has been established?

                  Of course, after open() you can do what you need.

                  P 1 Reply Last reply 25 Mar 2020, 15:31
                  0
                  • K kuzulis
                    23 Mar 2020, 06:10

                    @Pablo-J-Rogina said in Cannot output a value using QSerialPort:

                    Are you saying that you can change the settings once a connection has been established?

                    Of course, after open() you can do what you need.

                    P Offline
                    P Offline
                    Pablo J. Rogina
                    wrote on 25 Mar 2020, 15:31 last edited by
                    #52

                    @kuzulis but changing the settings once you open the port, does impact on the ongoing connection?
                    I mean, does the other side need to update the settings as well? And if so, won't the connection be interrupted?

                    Upvote the answer(s) that helped you solve the issue
                    Use "Topic Tools" button to mark your post as Solved
                    Add screenshots via postimage.org
                    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      kuzulis
                      Qt Champions 2020
                      wrote on 25 Mar 2020, 18:17 last edited by kuzulis
                      #53

                      @Pablo-J-Rogina said in Cannot output a value using QSerialPort:

                      @kuzulis but changing the settings once you open the port, does impact on the ongoing connection?
                      I mean, does the other side need to update the settings as well? And if so, won't the connection be interrupted?

                      The serial communication has no "connection" things. About what "connection" do you speak?

                      PS: In reality (on a low level), any device configurations always changes after a device has been opened! This belongs to any device.

                      P 1 Reply Last reply 25 Mar 2020, 18:19
                      0
                      • K kuzulis
                        25 Mar 2020, 18:17

                        @Pablo-J-Rogina said in Cannot output a value using QSerialPort:

                        @kuzulis but changing the settings once you open the port, does impact on the ongoing connection?
                        I mean, does the other side need to update the settings as well? And if so, won't the connection be interrupted?

                        The serial communication has no "connection" things. About what "connection" do you speak?

                        PS: In reality (on a low level), any device configurations always changes after a device has been opened! This belongs to any device.

                        P Offline
                        P Offline
                        Pablo J. Rogina
                        wrote on 25 Mar 2020, 18:19 last edited by
                        #54

                        @kuzulis said in Cannot output a value using QSerialPort:

                        About what "connection" do you speak?

                        An ongoing transmission

                        Upvote the answer(s) that helped you solve the issue
                        Use "Topic Tools" button to mark your post as Solved
                        Add screenshots via postimage.org
                        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                        1 Reply Last reply
                        1
                        • K Offline
                          K Offline
                          kuzulis
                          Qt Champions 2020
                          wrote on 25 Mar 2020, 18:25 last edited by kuzulis
                          #55

                          @Pablo-J-Rogina said in Cannot output a value using QSerialPort:

                          An ongoing transmission

                          In this case an ongoing data stream just will be transferred with a new parameters (speed, parity ant etc).

                          1 Reply Last reply
                          2

                          53/55

                          25 Mar 2020, 18:17

                          • Login

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