6 Module 1 LC 4 Figure 7 Sub VI associated with previous figure requiring no

6 module 1 lc 4 figure 7 sub vi associated with

This preview shows page 6 - 8 out of 11 pages.

- 6 - Module 1, LC 4 Figure 7: Sub-VI associated with previous figure, requiring no numerical inputs What’s the difference between these two sub-VI examples? In the first case, the sub-VI is much CAUTION! One peculiarity to the way sub-VIs work involves the pink wires (the overall function flow). If you do not select the “outside” pink wires (the wire to the left of the first icon and to the right of the final icon), these wires will not appear in the sub-VI, and there will be no way to wire your sub-VI into other programs. If you would like to convert an “entire program” into a sub-VI (like your “travel forward” or “turn left” commands that you made as your Deliverable at the end of last week’s Learning Center), you must wire the beginning and end of these programs to “dummy commands.” For example, play a tone, then travel forward, then play a tone. Then you can create a sub-VI by selecting everything except for these “play tone” commands. Be sure to save your sub-VI when you create it, and every time you modify it. Your robot may behave in unexpected ways if you don’t remember to save all VIs and sub-VIs before running a program! Also, by saving a sub-VI, you can access it for other programs! To add a sub-VI to a program, use the Functions Palette. The “Select a VI…” command is just above the NXT Robotics menu (see Figure 8). Click the command and you will be prompted to select your sub-VI file.
Image of page 6