Example Code

Toggle User LED on cRIO Target

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.

    Hardware

  • CompactRIO|SingleBoardRIO

    Software

  • LabVIEW Real-Time Module
  • LabVIEW

Code and Documents

Attachment

Download All

Overview

The example demonstrates how to toggle the Real-Time user LED at a user-defined interval.

 

Description
With the 'NI_Real-Time Target Support.lvlib:RT LEDs.vi' function the user can access one or multiple (depending on the hardware) LEDs. The LED can have either a single color (default: green) or an additional color (default: yellow). With the LED(s) and LED color(s) the Real-Time target can indicate a certain device state without the need for a Graphical User Interface (GUI).

In this example a single-color LED is toggled at a user-defined interval.

The following link shows an example blinking the FPGA LED with a FPGA VI:

https://forums.ni.com/t5/Example-Programs/Blink-LED-on-a-cRIO-Target/ta-p/3526764

 

Requirements

 Software

  • LabVIEW 2012 Base Development System (or compatible)
  • LabVIEW 2012 Real-Time Module (or compatible)
  • NI-CompactRIO 13.0 (or compatible)

 Hardware

  • any NI Real-Time Target with a user programmable LED (e.g. NI CompactRIO)

Steps to Implement or Execute Code

  1. (Optional) Change the toggle period
  2. Run the RT.vi

Additional Information or References

RT.vi - Front Panel.png
RT.vi - Block Diagram.png
 

**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.**

Anuar R.
National Instruments México y Latinoamérica
Ingeniería de Aplicaciones
www.ni.com/soporte

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

Comments
JKSH
Active Participant
Active Participant
on

You can toggle the LED by wiring '3' into the "State" terminal. You don't need to write your own code to toggle between '1' and '2'.

Certified LabVIEW Developer