Example Code

Detect One-Directional Boolean Value Change using Polling

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 demonstrates how to poll the value change of a button to true.

 

Description

This VI shows how you can execute a block of code when a boolean control is change in one direction without using an event structure.


Requirements

 Software

  • LabVIEW Base Development System 2012 (or compatible)

 Hardware

  • No hardware is necessary to use this example VI

 

Steps to Implement or Execute Code

  1. Download and open the attached file
  2. Run the program

 

Additional Information or References

Detect Boolean Value Change Polling LV2012 NIVerified .vi - Front Panel.png
 
Detect Boolean Value Change Polling LV2012 NIVerified .vi - Block Diagram.png
 
Notes

You can use this same method for any data type, just set up the boolean logic to the need of your datatype.

 

 **The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text ‘NIVerified’. Read here for more information about the new Example Guidelines and Community Platform.**

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

Comments
Priley
Member
Member
on

A small added simplification, replace the 'not equal to' and the 'and' logic with a single 'greater than'

Priley
Member
Member
on

oh and...replace the 'on-loop' shift register and initialising with the new-ish shift register (left arrow) wire the switch into its initialisation input too.