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. Click to confirm output voltage from Arduino
Forum Updated to NodeBB v4.3 + New Features

Click to confirm output voltage from Arduino

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 2 Posters 1.5k Views
  • 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.
  • Macive XiongM Offline
    Macive XiongM Offline
    Macive Xiong
    wrote on last edited by
    #1

    Hey guys, I am doing a project to develop a GUI for voltage output from Arduino. The GUI is like this:
    Click to confirm output voltage from Arduino

    I am wondering if I can make the number I input waits until I click confirm button then sending the signal to Arduino. Because in this stage, once I put the number in the qspinbox, the voltage(number I input) would output from Arduino directly. Is there any way that I can let it waits till I press the Confirm Button for sending signal??

    Thank you so much:)
    Macive

    jsulmJ 1 Reply Last reply
    0
    • Macive XiongM Macive Xiong

      Hey guys, I am doing a project to develop a GUI for voltage output from Arduino. The GUI is like this:
      Click to confirm output voltage from Arduino

      I am wondering if I can make the number I input waits until I click confirm button then sending the signal to Arduino. Because in this stage, once I put the number in the qspinbox, the voltage(number I input) would output from Arduino directly. Is there any way that I can let it waits till I press the Confirm Button for sending signal??

      Thank you so much:)
      Macive

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Macive-Xiong Sure you can. I guess currently you're using http://doc.qt.io/qt-5/qspinbox.html#valueChanged signal to send the value to Arduino, right? If not how are you doing it?
      To achieve what you want use http://doc.qt.io/qt-5/qabstractbutton.html#clicked signal of the "Confirm" button. Add a slot and connect it to that signal. I the slot you can get the current value using http://doc.qt.io/qt-5/qspinbox.html#value-prop.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      Macive XiongM 1 Reply Last reply
      2
      • jsulmJ jsulm

        @Macive-Xiong Sure you can. I guess currently you're using http://doc.qt.io/qt-5/qspinbox.html#valueChanged signal to send the value to Arduino, right? If not how are you doing it?
        To achieve what you want use http://doc.qt.io/qt-5/qabstractbutton.html#clicked signal of the "Confirm" button. Add a slot and connect it to that signal. I the slot you can get the current value using http://doc.qt.io/qt-5/qspinbox.html#value-prop.

        Macive XiongM Offline
        Macive XiongM Offline
        Macive Xiong
        wrote on last edited by
        #3

        Dear @jsulm,

        You always shows up when I face some problem haha. Thank you so much:)
        Yes, I use qspinbox for my umber input. I will try the way you suggest and get back to you:)

        1 Reply Last reply
        0
        • Macive XiongM Offline
          Macive XiongM Offline
          Macive Xiong
          wrote on last edited by
          #4

          Hey guys,

          I still have trouble to write the code. I am not sure what codes should I write in the qpushbutton. Here are my code:

          My code

          Is there any suggestion what codes should I write in the qPushButton ??

          Thanks
          Macive

          jsulmJ 1 Reply Last reply
          0
          • Macive XiongM Macive Xiong

            Hey guys,

            I still have trouble to write the code. I am not sure what codes should I write in the qpushbutton. Here are my code:

            My code

            Is there any suggestion what codes should I write in the qPushButton ??

            Thanks
            Macive

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Macive-Xiong Same code as in on_input_box_value_changed? Move the code from on_input_box_value_changed to push button and get the value via http://doc.qt.io/qt-5/qspinbox.html#value-prop

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            Macive XiongM 1 Reply Last reply
            0
            • jsulmJ jsulm

              @Macive-Xiong Same code as in on_input_box_value_changed? Move the code from on_input_box_value_changed to push button and get the value via http://doc.qt.io/qt-5/qspinbox.html#value-prop

              Macive XiongM Offline
              Macive XiongM Offline
              Macive Xiong
              wrote on last edited by
              #6

              Hi @jsulm ,

              my code still can't work, please check my code.

              Is there any suggestion??

              jsulmJ 1 Reply Last reply
              0
              • Macive XiongM Macive Xiong

                Hi @jsulm ,

                my code still can't work, please check my code.

                Is there any suggestion??

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by jsulm
                #7

                @Macive-Xiong This code is completely wrong. Try this way:

                void MainWindow::on_push_button_clicked()
                {
                    MainWindow::updatevolt(QString("%1").arg(ui->doubleSpinBox->value()));
                }
                

                Make sure MainWindow::on_push_button_clicked() is connected to the clicked signal of the push button.

                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