Robotics with the Boe-Bot text v2.2
Chapter 2: Your Boe-Bot’s Servo Motors · Page 51
How HighLowLed.bs2 Works
Figure 2-6 shows how the BASIC Stamp can connect an LED circuit alternately to Vdd
and Vss. When it’s connected to Vdd, the LED emits light. When it’s connected to Vss,
the LED does not emit light. The command HIGH 13 instructs the BASIC Stamp to
connect P13 to Vdd. The command PAUSE 500 instructs the BASIC Stamp to leave the
circuit in that state for 500 ms. The command LOW 13 instructs the BASIC Stamp to
connect the LED to Vss. Again, the command PAUSE 500 instructs the BASIC Stamp to
leave it in that state for another 500 ms. Since these commands are placed between DO
and LOOP, they execute over and over again.
SOUT
SIN
ATN
VSS
P0
P1
P2
P3
P4
P5
P6
P7
VIN
VSS
RES
VDD
(
+5V
)
P15
P14
P13
P12
P11
P10
P9
P8
24
23
22
21
20
19
18
17
16
15
14
13
1
2
3
4
5
6
7
8
9
10
11
12
BS2-IC
BS2
Vdd
Vss
SOUT
SIN
ATN
VSS
P0
P1
P2
P3
P4
P5
P6
P7
VIN
VSS
RES
VDD (+5V)
P15
P14
P13
P12
P11
P10
P9
P8
24
23
22
21
20
19
18
17
16
15
14
13
1
2
3
4
5
6
7
8
9
10
11
12
BS2-IC
BS2
Vdd
Vss
Figure 2-6
BASIC Stamp
Switching
The BASIC Stamp
can be programmed
to internally connect
the LED circuit’s
input to Vdd or Vss.
A Diagnostic Test for your Computer
A very few computers, such as some laptops, will halt the PBASIC program after the first
time through a DO...LOOP loop. These computers have a non-standard serial port design.
By placing a DEBUG command the program LedOnOff.bs2, the open Debug Terminal
prevents this from possibly happening. You will next re-run this program without the
DEBUG command to see if your computer has this non-standard serial port problem. It is
not likely, but it would be important for you to know.
√ Open HighLowLed.bs2.
√ Delete the entire
DEBUG instruction.
√ Run the modified program while you observe your LED.
If the LED blinks on and off continuously, just as it did when you ran the original
program with the
DEBUG command, your computer will not have this problem.
If the LED blinked on and off only once and then stopped, you have a computer with a
non-standard serial port design. If you disconnect the serial cable from your board and