Discovering More PBASIC Programming Tricks
In This Chapter
Generating random numbers
Using a potentiometer as input
Creating subroutines with the
In this chapter, we describe some more PBASIC programming techniques, to add to the fundamental ones we introduce in Chapter 2 of this minibook. These tips are sure to become invaluable in your BASIC Stamp projects. Specifically, you discover handling input data in the form of pushbuttons, generating random numbers (that make your programs more interesting by adding a degree of randomness), reading the value of a potentiometer and using the
GOSUB command to organise your program into subroutines.
Pushing Buttons with a BASIC Stamp
In Chapter 2 of this minibook, we discuss connecting a light-emitting diode (LED) to a BASIC Stamp I/O pin and turning the LED on or off by using the
LOW commands in a PBASIC program. Those commands are designed to use BASIC Stamp I/O pins as output pins by setting the status of an I/O pin to high or low so that external circuitry (such as an LED) can react ...