LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

1 Button 2 Functions

Im working with Luminary Micro Evaluation Board (LM3S8962). In a case structure One case Clears screen when select button is pushed. I would like to make it so it also Stops the program when the same button is pushed for a period of time....Lets say 5 seconds.....But if the select button is not pushed and held then it just clears screen and keeps running. I cant seem to figure out how to use the Elapsed Time VI correctly or maybe there is another way..??? Also What I've tryed with the Elapsed time VI it seems to pick up where it left off as far as counting so by the time I push select lets say 3 times (eventhough push and release) it returns a true. Can anyone help?

0 Kudos
Message 1 of 5
(2,554 Views)

I did this with an event structure, a timer "state" enum passed by shift register on the surrounding while loop and the following events:

 

  1. Timeout: resets or doesn't reset an Elapsed Timer set for 5 seconds based on the timer state. "Timer Elapsed" output goes to While Loop conditional terminal.
  2. Select Button- Mouse Down? Filter event: Sets the enum to "Start Timer"
  3. Select Button- Mouse Up: Sets the enum to "Stop Timer"
  4. Select Button- Value Change: Does some task (clear screen) and passes out "Stop Timer".

With this method you would have to make sure you pass the timer state enum in every event.

0 Kudos
Message 2 of 5
(2,539 Views)

Im an electronics student and I just got started with Labveiw so everything is still pretty confusing. I opened up an event structure but as I started disecting it and reading about it I became Very lost. If you dont mind, Can you break it down like your talking to a four year old :). Do I use the event structure outside of the case structure? Do i use it in the same case as the reset button or make another case??? What terminals do I need to connect to what....... I was up reading about the parts of the Event structure which seemed to get me nowhere because I needed to know what the other things are that are involved. What I am building is an Etch-a-Sketch to run on an ARM controller OLED. Everything works except this stop button Idea.

0 Kudos
Message 3 of 5
(2,496 Views)

Here you go (LV2012).

0 Kudos
Message 4 of 5
(2,486 Views)

I noticed a slight performance problem in the program I posted. Move the "Select" control in the block diagram from the Timeout case to the Value Change case. It will be more responsive.

0 Kudos
Message 5 of 5
(2,473 Views)