LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When i dont press the button i want the value start to decrease by itself

Dear all,

 

I am controlling a numeric control value in the front panel : I am pressing increase button to increase the value, but what I want is that when i stop pressing the increment button the numeric value should decrease by itseft (automatically) Please, I need your help. 

 

Kind Regards from Turkey.

Have a nice day.

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

Well, that should not be very hard. How should it decrease (e.g. linearly? instantly? randomly? exponentially to some other value (e.g. zero)?)

 

To programmatically change a control, you would typically write to a local variable of it. You can also make the numeric an indicator and add a seperate boolean for the increase function. What have you tried so far?

 

 

Message 2 of 11
(3,242 Views)

Dear altenbach,

 

Firstly thank you for your reply, actually i couldnt try any of these, I have something in my mind but I am sure it wont work. I am not very good at programming, I want it to decrease Linearly to Zero. Could you pls attach a basic vi similar to this. It would be very helpful. Looking forward for your response.

 

Special Note: I want this because i am controlling motor, so that I am increasing speed with pressing incremental increase on numeric control which is on the front panel, but when I stop pressing the numeric control button(speed control button), the numeric value(speed) should decrease by itself, like a real car.

 

 

Have a nice day, 

Kind Regards from Turkey.

 

 

0 Kudos
Message 3 of 11
(3,227 Views)

Salander wrote:

Firstly thank you for your reply, actually i couldnt try any of these,


Why not?


Salander wrote:

I have something in my mind but I am sure it wont work.


Then put something else in your mind! Don't spend thoughts on things that won't work.


@Salander wrote:

I am not very good at programming, I want it to decrease Linearly to Zero.


What have you tried so far? Nobody is good at programming until they program for a while and learn new skills.

 

A car does not decrease the speed linearly to zero.

 

If you are controlling a real car with real hardware, it will decrease to zero automatically due to friction and wind resistance, so why would you need to program it?

 

If you are trying to simulate a car in software, create a software model that simulates a car based on parameters (current speed, mass, inertia, slope, wind resistance, drag coefficients, rolling resistance, friction, engine power, etc.).

 

I would recommend to open the example finder an look at some examples. have a look at the "tank simulation.vi", and substitute tank level with speed, or look at "vibration analysis.vi". See how the rotation speed decreases slowly if the velocity is set to zero.  😉

 

Attached is a simplified version, hopefully it can give you some ideas. If this is for school, you need to make sure that you fully understand the reason for every little detail in the program and can explain it to you teacher if needed. Try to expand the functionality by adding a brake pedal, for example. 😄

Message 4 of 11
(3,218 Views)

Dear altenbach,

 

Thank you for your response, the attached vi is really helpful for my project, I fully understand it, it gave me good ideas.

 

Best Regards,

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

Dear all,

 

there is also one more thing that is very confusing for me which is indicated below:

I want to control this motor via arrow keys on the keyboard. But only buttons i can use are Home, Page Up, Page Down, End, F1, F2, F3... etc How can I do it is like playing in a car racing game??

 

Thanks in advance.

0 Kudos
Message 6 of 11
(3,166 Views)

Use [<this VI>... key down] events.

 

Then look for Vkey=right or left, for example using a case structure.

Message 7 of 11
(3,153 Views)

Dear altenbach,

 

I did not understand anything from your first sentence, did you try to attach vi when you say  [<this VI>... key down]?

 

Thanks you.

 

0 Kudos
Message 8 of 11
(3,137 Views)

add an event structure, then configure an event. One option is to create a key down event for the VI.

Message 9 of 11
(3,130 Views)

Try the following draft (LabVIEW 8.2) to see the general idea.

 

Message 10 of 11
(3,125 Views)