LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Speedometer of a car

Solved!
Go to solution

Hi: 

I want to create a gauge that increases his value gradually when pressing the acceleration a button and decreases gradually pressing the brake button I have no clue how to do it any comment would be of much help. Here´s a picture of the front panel. Thanks.

0 Kudos
Message 1 of 3
(1,852 Views)
Solution
Accepted by topic author Manu1598

A speedometer measures velocity.  An accelerator accelerates (or increases velocity at some rate), while a brake acts as a "decelerator", decreasing the velocity at some rate (with an interesting non-linearity that if the velocity is 0, i.e. the car is stopped, pressing the brake doesn't do anything to the motion of the car).

 

How would you model "increasing as a function of time"?  Where, in LabVIEW, can you find "Time"?  [Hint -- look at the main Palette on the Block Diagram].  Now, figure it out (you might want a loop somewhere, possibly a shift register to hold the current velocity that you might increase or decrease according to some rule).

 

Bob Schor

 

Edit -- the first sentence is wrong -- a speedometer measures speed (which is closely related to, but different from, velocity).  Oops ... but it still doesn't change the main point.

0 Kudos
Message 2 of 3
(1,833 Views)
Solution
Accepted by topic author Manu1598

@Manu1598 wrote:

Hi: 

I want to create a gauge that increases his value gradually when pressing the acceleration a button and decreases gradually pressing the brake button I have no clue how to do it any comment would be of much help. Here´s a picture of the front panel. Thanks.


A gauge has no control over it's data. It simply display whatever is in the wire connected to it.

The solution to your problem is on the diagram, not on the front panel.

 

I probably would start with a simple state machine, keeping the current speed in a shift register connected to the gauge. Use reasonable tuning parameters (loop rate, acceleration(speed), deceleration(speed), friction (i.e. deceleration if nothing is pressed), max speed, min speed, etc.) and increment/decrement the speed based on the settings and current speed. Code will be trivial and will probably fit on half a postcard.

 

As you might have read in other posts, pictures are useless. If you want specific help, attach your VI.

 

Make sure your controls are switch until release to work properly

 

 

0 Kudos
Message 3 of 3
(1,777 Views)