CHAPTER 12 DECISIONS, DECISIONS
Data Matrix 2d Barcode Generation In None
Using Barcode drawer for Font Control to generate, create ECC200 image in Font applications.www.OnBarcode.com
Encode Data Matrix In None
Using Barcode maker for Font Control to generate, create Data Matrix 2d barcode image in Font applications.www.OnBarcode.com
seen in Figure 12-23 (rotating the robot to the right). After a turn is made, the final MOVE block (see Figure 12-24) will have the robot roll forward 10 rotations.
Encode UPC Symbol In None
Using Barcode drawer for Font Control to generate, create GTIN - 12 image in Font applications.www.OnBarcode.com
GS1 128 Drawer In None
Using Barcode maker for Font Control to generate, create UCC-128 image in Font applications.www.OnBarcode.com
Figure 12-19. The complete program and the first MOVE block s configuration panel
Drawing Code 39 Extended In None
Using Barcode creator for Font Control to generate, create Code 39 Full ASCII image in Font applications.www.OnBarcode.com
Create QR Code In None
Using Barcode encoder for Font Control to generate, create QR Code image in Font applications.www.OnBarcode.com
Figure 12-20. The COLOR SENSOR WAIT block s configuration panel
EAN / UCC - 13 Generator In None
Using Barcode generator for Font Control to generate, create GS1 - 13 image in Font applications.www.OnBarcode.com
ISBN Printer In None
Using Barcode generation for Font Control to generate, create ISBN - 13 image in Font applications.www.OnBarcode.com
Figure 12-21. The SWITCH block s configuration panel
Create Data Matrix ECC200 In Objective-C
Using Barcode generation for iPad Control to generate, create ECC200 image in iPad applications.www.OnBarcode.com
Creating Data Matrix ECC200 In None
Using Barcode printer for Word Control to generate, create Data Matrix ECC200 image in Word applications.www.OnBarcode.com
CHAPTER 12 DECISIONS, DECISIONS
Printing Code 128 Code Set A In Objective-C
Using Barcode generation for iPhone Control to generate, create ANSI/AIM Code 128 image in iPhone applications.www.OnBarcode.com
2D Barcode Generation In Visual Basic .NET
Using Barcode generation for .NET Control to generate, create 2D image in Visual Studio .NET applications.www.OnBarcode.com
Figure 12-22. The true path MOVE block s configuration panel
Encode PDF 417 In Java
Using Barcode maker for BIRT Control to generate, create PDF-417 2d barcode image in Eclipse BIRT applications.www.OnBarcode.com
Paint Barcode In Java
Using Barcode creator for Java Control to generate, create Barcode image in Java applications.www.OnBarcode.com
Figure 12-23. The false path MOVE block s configuration panel
Encode GS1 DataBar Limited In .NET Framework
Using Barcode encoder for VS .NET Control to generate, create DataBar image in Visual Studio .NET applications.www.OnBarcode.com
PDF 417 Generation In VS .NET
Using Barcode printer for Reporting Service Control to generate, create PDF417 image in Reporting Service applications.www.OnBarcode.com
Figure 12-24. The final MOVE block s configuration panel
Barcode Recognizer In Visual Basic .NET
Using Barcode Control SDK for .NET framework Control to generate, create, read, scan barcode image in Visual Studio .NET applications.www.OnBarcode.com
ECC200 Creation In None
Using Barcode drawer for Excel Control to generate, create ECC200 image in Office Excel applications.www.OnBarcode.com
C H A P T E R 13
Generate GS1 - 13 In Visual Studio .NET
Using Barcode generation for ASP.NET Control to generate, create EAN-13 image in ASP.NET applications.www.OnBarcode.com
Barcode Printer In .NET
Using Barcode drawer for .NET Control to generate, create Barcode image in VS .NET applications.www.OnBarcode.com
This will be another short chapter. How much can one really say about a block that simply stops your program from running
The STOP Block
The most important thing you need to know about the STOP block is this: if your robot encounters a STOP block at any point in the program, the robot will simply stop at that point with no further action (there is one exception and that is when you are using data wires more on that later). Why would you need a STOP block Your robot will always stop when it reaches the end of your program unless you have a LOOP block somewhere in the program that keeps the program running (or a LOOP block surrounding all other programming blocks, which means the program will run forever until you press the Cancel button or a STOP block is encountered somewhere in the inner workings of your program). So why a STOP block It s because once you begin looping, you need a way to stop looping.
A Looping Example
The STOP block is shown in Figure 13-1. Notice in its data hub that it only has one input data plug and one output data plug, which can use a Logic data type.
CHAPTER 13 STOP IT!
Figure 13-1. The STOP block and its configuration panel As I mentioned earlier, the STOP block will immediately stop the program when the STOP block is reached unless a data wire is providing a False input (signal) to the STOP block s input data plug. Let s look at the example in Figure 13-2.
Figure 13-2. A simple program using the STOP block In Figure 13-2, I ve got a small program for SPOT. It s a LOOP block that contains a TOUCH SENSOR block, a STOP block, and a SOUND block. When the program is run, every time the LOOP block loops, SPOT
CHAPTER 13 STOP IT!
will beep (using the SOUND block). This will continue until the Touch sensor is pressed. When the Touch sensor is pressed, a True response is sent (using the data wire) to the STOP block s input data plug. And the program will stop. As long as the Touch sensor is not pressed, the STOP block will continue to receive a False response from the Touch sensor and will not stop the program. Simple!
An Unconditional STOP
Now, what do you think would happen if I didn t connect a data wire between the Touch sensor and the STOP block, as shown in Figure 13-3
Figure 13-3. Modifying the sample program s data wire completely changes the way it works. You can load the program and try it, but if you walk through the simple program visually I think you ll figure it out. When the program runs, the LOOP block starts. The Touch sensor block runs, followed by the STOP block. Will the program execute the SOUND block The answer is, No. Remember my initial rule: the program will stop running when it executes a STOP block and will perform no further actions. This program will stop immediately and never execute the SOUND block (run the program to prove it to yourself).
A SWITCH to a STOP
You might be wondering when you would ever want to put a STOP block in the middle of a program. Well, one answer involves the SWITCH block. Recall that using the SWITCH block allows your robots to choose different action paths to take. One path might send your robot into some more complex programming behavior while the other path might be a simple STOP block. Take a look at Figure 13-4, which shows an example of this process.
CHAPTER 13 STOP IT!
Figure 13-4. A SWITCH block might need a STOP block to keep your robot safe. In this example, I ve placed SPOT on a tall table. SPOT s Touch sensor is mounted facing downward on the table, so the button is pressed. If SPOT reaches the edge of the table, the Touch sensor button will no longer be pressed, right (There s no table surface to continue to press against the button.) Figure 13-4 shows a simple LOOP block that contains a SWITCH block. I ve configured the SWITCH block to test whether the Touch sensor button is Released. If it is, the True path will be selected. If the button is still pressed, the False path will be selected. I want SPOT to stop immediately when the Touch sensor button is released, so I place a STOP block in the True path and a MOVE block in the False path. As long as the button is pressed, SPOT will keep moving forward. But for SPOT s safety, once the button is released (and he s reached the edge of the table), I want the program to immediately end. The trick to this program is placing the Touch sensor far out in front of SPOT, so he s still safely back from the edge when the button is released. Try it!