LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

A simple question for creating a button

Solved!
Go to solution

Hello everyone,

 

I want to create a button that when I click one time, the number of a indicator will increase 1, I prefer to use the function FEEDBACK, and the vi should be able to run all the time.

Could someone give me an idea please?

 

Thank you!

0 Kudos
Message 1 of 11
(3,276 Views)

 Use an event case for the button value change.  Increment the value of the numeric indicator in that case, store it in a feedback node. 

 

Place a while loop around the event structure.  It will run forever.  You might want to have a way to stop the executionSmiley Wink

 

Is this homework?


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 11
(3,267 Views)

Hello,

in order for your VI to work constantly,

You need a while loop.

Then you need an event structure, as a purpose of incrementing every time the button is pressed.

PS: add another event and place the Stop button inside of it, as a purpose to stop the loop.

button increment.jpg

Have fun programming in LabVIEW.

Greetings and Regards,
James
0 Kudos
Message 3 of 11
(3,248 Views)

Hello Jeff,

 

Actually I am in a intership, I need to create a button with almost same effect which wil use to controle a stepper motor. Thank you so much for giving me ideals.

 

Thanks a lot!

0 Kudos
Message 4 of 11
(3,241 Views)

Hello James,

 

Thank you for giving me idea, but I'm sorry that I maybe did't explain clearly my question. I want to create a button which I click one time and the number of a indicator will increase 1, then I re-click one time, the number increase 1. So I think that button is not the STOP Button, I'am sorry for that, could you please give me another idea? Maybe in using Feedback node or not?

 

Thanks a lot.

0 Kudos
Message 5 of 11
(3,234 Views)

When using a loop, you should store your count in a shift register.  The loop with an event structure is where to start.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 11
(3,228 Views)
Solution
Accepted by topic author C.LI

Hello Li,

here is what you are looking for:

increment.jpg

if you look carefully on my first post, you will notice on the upper left corner, that the selector label is 1 ( [1] “stop”: Value Change ) which means, this is the second case in the event (since the event starts with the index 0).

 

I already provided you some links, please read them first.

Then, follow these steps:

 

Go on the Front Panel and place a stop and an increment(OK) button,

Right Click>> Bolean >> OK Button (if you put your cursor on the OK, you can change the name to Increments)

 

Next you go on the Block Diagram, and type the following:

Ctrl+ Space >> Feedback Node

Ctrl+ Space >> Increment

Then you just have to create the events inside of the event structures.

 
Is the problem solved? Then please mark it as solved and hit the yellow star.

Have fun programming on LabVIEW.

 

 

PS: My welcome package to you

NI Learning Center

NI Getting Started

-Hardware Basics

-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide

 

Learn NI Training Resource Videos

3 Hour LabVIEW Introduction

6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training

 

Greetings and Regards,
James
Message 7 of 11
(3,212 Views)

Hello Jeff

 

Thank you for giving me idea, but I'm sorry that I maybe did't explain clearly my question. I want to create a button which I click one time and the number of a indicator will increase 1, then I re-click one time, the number increase 1. So I think that button is not the STOP Button, I'am sorry for that, could you please give me another idea? Maybe in using Feedback node or not?

 

Thanks a lot.

0 Kudos
Message 8 of 11
(3,210 Views)
Solution
Accepted by topic author C.LI

1.png

There are a few ideas in there.  Enjoy learning LabVIEW while you work on your internship!

 

Of course, for the simplistic truth meeting your exact requirements, the Feedback Node is totally unnecessary! (Use i)

1.png


"Should be" isn't "Is" -Jay
Message 9 of 11
(3,197 Views)

Dilbert's Pointy-Haired Boss used an intern to flap his arms so the motion sensor on his office light would keep the light on.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 11
(3,172 Views)