Pro Tips

Here are some tips we have found to make programming in LabVIEW faster and cleaner.  They are not necessary, but might make your life a little easier.

Code outside the lines

The power of LabVIEW is that you can execute multiple functions at the same time.  Every so often, this can lead to "race conditions," when multiple functions are "racing" to control the same elements (e.g. parts of your code making the motors run at different speeds at the same time), but most of the time, it's incredibly useful to have different processes running in parallel.  Also, it's very simple to do--just don't wire them together.

Save space by setting the default name for programs downloaded to the NXT

The NXT doesn't have a great deal of memory, so this is an easy way to save space.  Go to "Tools --> NXT Preferences" and select "Target NXT" from the sidebar.  Select the option "Use default name (NXT.rxe)."  Now, every program you send to the NXT will be called "NXT.rxe" instead of the title of the VI, and it will write over the previous program sent.  This means that you can only have one program on the NXT at a time, but if you ever need more than that, you can always change it back.

Keyboard shortcut for targeting to the NXT

There are a lot of ways to switch between direct and remote mode.  If you're switching between them a lot (e.g. while debugging a program on the NXT), this keyboard shortcut is incredibly helpful.  You need to set it up in NXT Preferences ("Tools --> NXT Preferences" in the Menu bar).  Select "Miscellaneous" from the sidebar and be sure the keyboard shortcut is checked.  On a Mac, this shortcut is Cmd+T.  On a PC, this command is ctrl+T.

Other VERY useful keyboard shortcuts

Duplicate a VI in your program: Hold "Option" while clicking a dragging an icon to duplicate it and place it somewhere else in the program.
Create space in part of your VI: To create space in a cramped part of your program, hold down "Option" and click and drag through the white space.  This shifts all VIs right and down by the amount that you drag
Delete all broken wires: Mac: Cmd+B  PC: Ctrl+B
Toggle between the front panel and block diagram of your VI: Mac: Cmd+E  PC: Ctrl+E
Run Program: Mac: Cmd+R  PC: Ctrl+R
Abort Program: Mac: Cmd+.  PC: Ctrl+.
The usual lineup: ctrl+z, ctrl+x, ctrl+v, ctrl+c, ctrl+s... (cmd+__ for Mac)

Clean Up Code

Messy code can be impossible to follow and even harder to debug, especially if you aren't the one who wrote it.  There is a button for automatically cleaning up your entire block diagram.  It can be found at the top of the block diagram window (it looks like a broom sweeping up an addition icon).  This can be useful, but possibly not the best solution if you have moderately complex code.  What can be much more useful is selecting a portion of messy code, right clicking, and selecting "Clean up code" from the drop down.  Also, try right-clicking a messy wire and selecting "Clean up wire."

Make the Control and Indicator icons smaller in your block diagram

You may be surprised how much cleaner your code will look, especially when you have a lot going on in your front panel.  Go to LabVIEW Preferences.  On a Mac, this can be done by clicking "LabVIEW --> Preferences" on the Menu bar.  On a PC, go to "Tools --> Options."  Click "Block Diagram" on the sidebar.  Under "General," make sure "Place front panel terminals as icons" is unchecked.  Also, if you placed any controls or indicators in your program before changing this preference, you can right-click them and uncheck "View as icon" from the drop down.

Uploading a Sound File

Take a song or file in your iTunes and convert it from an MP3 file to a WAV file by going to iTunesà PreferencesàImport Settings and choosing the WAV Encoder. Then choose the file in the library; go to AdvancedàCreate WAV version and a new version of the file will be created.

After you have the WAV version, download and open up the NeXT Tools application, which you can find in the Additional Resources tab of this website, and under Programmable Brick Utilities

. Select the Sound Conversion icon. Select the new WAV file from your iTunes and press Convert. 


Comments