Specifications

BASIC Stamp II
Page 338 • BASIC Stamp Programming Manual 1.8 • Parallax, Inc.
OUT2 = IN2 ' Make output driver match pin state.
TOGGLE 2 ' Then toggle.
If you change the previous example to copy IN2 to OUT2 before Tog-
gling, you’ll see that the state of the pin does change.
Demo Program
Connect LEDs to pins 0 through 3 as shown in figure I-28 and run the
program below. The Toggle instruction will treat you to a light show.
You may also run the demo without LEDs. The debug window will
show you the states of pins 0 through 3.
thePin var nib ' Variable to count 0-3.
again:
for thePin = 0 to 3 ' Pins 0 to 3 driving LEDs.
TOGGLE thePin ' Toggle each pin.
debug cls,bin4 INA ' No LEDs? Watch debug screen.
pause 200 ' Brief delay.
next ' Next pin
goto again ' Repeat endlessly.
220
LED
0
220
LED
220
LED
220
LED
1
2
3
Pins
Figure I-28