Example Code

Keyboard Event for Deadman Switch 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 code implements a deadman switch using the spacebar of a keyboard.

 

Description

When dangerous machinery is being operated, test operators may want to implement a deadman switch so that a keyboard key must remain depressed for the test to continue. This code will wait on the user to start executing and then the main loop will stop if the user releases the spacebar. The code uses two event structures, one to start the code to be controlled and one to stop the code.

 

 

Requirements

Software

LabVIEW 2013 (or compatible)

  

Steps to Implement or Execute Code

  1. Run the VI
  2. Press the spacebar
  3. Release the spacebar and the VI will stop running

 

 

Additional Information or Reference

 1-396BD.png

 

1-396FD.png

 

 

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

 

Rob B
FlexRIO Product Manager

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