Example Code

Am I sober? VI

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

Download All

Overview

This page was made for LabVIEW beginners to show how it could perform multiple data manipulation tasks in an efficient manner.

Here is a VI that determines if an individual is allowed to drive and calculates how long he/she must wait in order to drive after drinking to avoid drunk driving based on his/her activities and country.

The VI takes into account,the sex, the weight, number of drinks, time since the last drink, and if the individual was eating in order to determine its results.

The VI also considers the country of which the individual is in, to determine whether he/she is within the national limit or not.

 

Description

This VI uses several case structures and select functions to allow flexibility in the code.

The user, thanks to case structures can select the country he/she is in and his/her sex to use specific parameters associated in the code to achieve a precise calculation.

The Mathematics palette is used for data manipulation.

This VI is intended to show the flexibility of LabVIEW in a fun way, when dealing and manipulating data with mathematics palette, customizing case by case dataflow to execute a task in an efficient way.

 

Requirement

  1. LabVIEW 2013 SP1 (or compatible)

 

Steps to Implement or Execute Code

  1. Simply open the VI attached and input your different settings and run the code .
  2. How to reproduce key features of this VI

Functionality

  1. Use Case Structures and Select functions to execute a specific choice of code based on the state of a specific parameter (Boolean control or enum).
  2. Using numerical constant and the mathematics palette to manipulate your data.

Front Panel

  1. Simply drag and drop images from a folder to add an image to the front panel.
  2. Using Shapes and clicking on the "Move to Back" in the tool bar option to have the different objects on the shape.
  3. Using Properties to change size and different aspects (items for enums or colors for LED states.).

 

Additional Information or References

Block Diagram

250.JPG

 

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

Applications Engineer Intern
National Instruments UK and Ireland

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

Comments
RER
NI Employee (retired)
on

Fun application! However, the app is tricky to use with out knowing which unit of weight the code is expecting

Rich Roberts
Senior Marketing Engineer, National Instruments
Connect on LinkedIn: https://www.linkedin.com/in/richard-roberts-4176a27b/
MarkGhannam
NI Employee (retired)
on

Edited! The weight is in kg .

Applications Engineer Intern
National Instruments UK and Ireland
Tepig
Active Participant
Active Participant
on

Very nice app! i think it will be better that user can select the unit of time since drinks minute or hour!

Certified LabVIEW Developer
There are only two ways to tell somebody thanks: Kudos and Marked Solutions

GCentral