Example Code

Record Sequence of Button Presses for 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 example records the sequence of button presses, and returns it in order. 

   

Description

There are three Boolean buttons on the front panel. The user can press these inputs in any order and then press the stop button when they are finished. The VI will return the sequence of the button presses in an array. One example use would be for recording a sequence of an event based state machine. The code could even be expanded to log the presses buttons on your keyboard.

 

Requirements

  • LabVIEW 2013 (or compatible)

 

Steps to Implement or Execute Code

  1. Run Button Sequence Example.vi
  2. Select Button 1, Button 2, and Button 3 in an assorted order.
  3. You can select the buttons as many times as you like.
  4. Select the Stop Button.
  5. The Button Press Sequence Array will display the order in which the buttons were selected.

Additional Information or References

The following is the front panel and block diagram used for the example code:

Capture.JPGCapture2.JPG

 

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

Tim, CLD, CTD
National Instruments (UK & Ireland)
________________________________________________
"No problem is insoluble in all conceivable circumstances"

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