Example Code

Press and Hold Down Button Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview
This VI demonstrates how it is possible to force a user to press and hold a button in order for a specific action to occur.


Description
The accuracy of the button hold time is controlled by the event structure timeout value. The smaller this value is the quicker the loop will iterate. Therefore, it will be able to detect a change in the button's value in less time. However, because the loop is running more quickly, it will consume more resources on your machine.
Requirements

  • LabVIEW 2012(or compatible)


Steps to Implement or Execute Code

  1. Open the VI
  2. Set time of “Seconds to Hold” and “Event Structure Timeout”.
  3. Click Run and press and hold on “Hold to Stop VI” button to stop program.

Additional Information or References

 5-322.png

 **This document has been updated to meet the current required format for the NI Code Exchange.**

 

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.