To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This example demonstrates how to check if a USB stick is connected to a Compact RIO real-time target.
Description
The cRIO controllers have a feature for data safety which enables them to switch from saving to a USB storage device, to their internal memory. If you are storing data to your USB storage device and suddenly remove it, the controller will create a folder named U (the same as the drive letter of the USB) and continue storing data there. In order to avoid this, or make sure that you only store data if the USB device is present, you can use this attached code in parallel or preferrably periodically with your code. You can use it as part of your decision making process on whether to start (or continue) logging or not.
Requirements
Software
Hardware
Steps to Implement or Execute Code
Additional Information or References
Note: This example was created to be used on VxWorks real-time targets. If running this example on NI Linux Real-Time targets you might have to use different paths as described in the Working with File Paths on Real-Time Targets tutorial.
**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.**
Description-Separate-2Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.