Example Code

Traffic Light State Machine Demo 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

Demo traffic light by using state machine 

 

Description

This project indicates the use of state machines and how they can be easily created using a number of basic elements;

  • Type defined enum
  • While Loop
  • Shift registers
  • Case strucuture

Requirements

Software

LabVIEW 2013 (or compatible)

 

Steps to Implement or Execute Code

  1. Run the VI
  2. The Red light would turn on at first, then the amber light turn on for 1sec.
  3. Both red and red light turn off.  Green light turn on.
  4. Press the "Turn on red light" button. The amber light would turn on at first, then the red light turn on. 

Additional Information or Reference

 1-384FD.png

 

1-384BD.png

 

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

__________________________
Aidan H

Applications Engineer
National Instruments UK & Ireland

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