Find how long is a button pressed in LabVIEW

製品と環境

このセクションは、サンプルの作成に使用された製品およびOSを反映します。

以下に示された製品を含め、NIのソフトウェアをダウンロードするには、ni.com/downloadsをご覧ください。

    ソフトウェア

  • LabVIEW

コードとドキュメント

添付

すべてをダウンロード

1. Overview:

This example shows how to code a program that calculates how long a button is pressed using an event structure.

 

2. Description: 

This VI uses the properties of the event structure to calculate the time a button is pressed. As the structure provides the time for the Mouse Down and Mouse Up events, the time between them can be calculated by taking a timestamp in the Mouse Down event and subtracting it to the timestamp provided in the Mouse Up event. This is how the code is implemented in this example.

 

3. Requirements

  • LabVIEW 2012 (or compatible)

4. Steps to Implement or Execute Code

  1. Run " Time While Button Pressed LabVIEW 2012 NI Verified.vi"
  2. Click OK Button and mantain it clicked. The Time Pressed (ms) will display the time elapsed.
  3. Click Stop to finish the execution

5. Additional Information or References 

VI Block Diagram

Block Diagram.JPG

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

Regards,
Efrain G.
National Instruments
Visit http://www.ni.com/gettingstarted/ for step-by-step help in setting up your system.

NIコミュニティのサンプルコード交換のサンプルコードは、MIT Licenseによりライセンス供与されています。