the shift register will carry the information regarding the next page in the

The shift register will carry the information

This preview shows page 9 - 11 out of 11 pages.

the shift register will carry the information regarding the next page in the playbook (case in the Case Structure). Your state machine, at the very outside, consists of a loop with a shift register around a case structure (playbook), like in the figure below. Figure 11: Case Structure within a loop, the very outside of a state machine in LabVIEW NXT As we’ve already seen, the Case Structure, by default, has two cases, True and False. You can change the names of these by double-clicking the word True or False. Since we will be passing
Image of page 9
- 10 - Module 1, LC 4 integers into our case structure, change False to 0 and True to 1. To add more cases, right-click the drop-down menu’s arrow and select Add Case After. Do this as many times as necessary. Remember that when dealing with a shift register, one case in your Case Structure must be the default case. Once you have wired a numerical value to the green box on the Case Structure, the option to set a case as the default one appears if you right-click the name of a case in the drop- down menu. The Select command, located in the Comparison menu, is used inside the Case Structure to help program state transitions. As discussed in lecture, the Select command outputs a number based on the evaluation of a True/False statement. If you need to have more than two possible state transitions, you can use combinations of Select commands and arithmetic, as necessary. The Create >> Constant command is less helpful for us in the case that we want to have a single value inside the Case Structure passed outside. In order to create constants, we must select them manually from the Functions Palette. Constant integers are available in the Numerics menu, and Constant true/false values are available in the Boolean menu. This is typically the approach you want for connecting elements from your Case Structure to the Conditional Terminal in the loop, and numeric values to from the Case Structure to the shift register in the loop. 1 Let’s practice building a state machine by creating one with four states: 0 is the start case, 1 is the plan to travel around the Right-Angle Course, 2 waits for further instructions, and 3 is the stop case. The state diagram is shown in the figure below. In the start case 0, your robot should wait for a cue of your choice to begin (a clap, pressing the touch sensor, changing the value of the light sensor, etc.). Once it receives this cue, it should move to state 1. Case 0 is the default case. In state 1, the robot should move around in one complete square (such as the Right Angle course). When it is finished, it should automatically enter state 2. In state 2, the robot should not move, but wait to know whether it should go back to state 1, or enter the stop state. Come up with a way to communicate your desire to the robot, again using at least one sensor.
Image of page 10
Image of page 11

You've reached the end of your free preview.

Want to read all 11 pages?

  • Fall '14
  • Combo box

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes