Example Code

Toggle Digital Output at Random Intervals

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

Software based random toggle time for a Digital Output line.

 

Description

This VI uses the random number generator to map the random values between 0 and 1 to an interval between 3 and 5 seconds. This random time is used with the Wait (ms) function to toggle a digital output with random software timing.

 

Requirements
1. LabVIEW 2012 or compatible
2. NI DAQmx compatible version

 

Steps to Implement or Execute Code
1. Specify the output line for the Digital Output Task.
2. Select the Run button.

 

Additional Information or References

Snippet.png

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

Comments
Todd S.
NI Employee (retired)
on

Thanks for posting!  Please rename your attachment to include the LabVIEW version ("_lvXX.vi" would be fine).

Todd S.
LabVIEW Community Manager
National Instruments