BASIC stamp manual v2.2
TOGGLE – BASIC Stamp Command Reference
Page 456 • BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com
guarantee that the state actually changes, regardless of the initial input or
output mode, do this:
PIN2 = PIN2 ' make output driver match input
TOGGLE 2 ' then toggle
- or -
OUT2 = IN2 ' make output driver match input
TOGGLE 2 ' then toggle
Figure 5.47: Example LED Circuit
for TOGGLE Demo Programs.
Demo Program (TOGGLE.bs1)
' TOGGLE.bs1
' Connect LEDs to pins 0 through 3 as shown in the TOGGLE command descrip-
' tion in the manual and run this program. The TOGGLE command 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.
' {$STAMP BS1}
' {$PBASIC 1.0}
SYMBOL thePin = B0 ' pin 0 - 3
Setup:
DIRS = %1111 ' make LEDs output, low
Main:
FOR thePin = 0 TO 3 ' loop through pins
TOGGLE thePin ' toggle current pin
DEBUG CLS, %PINS ' show on Debug
PAUSE 100 ' short delay
NEXT
GOTO Main ' repeat forever
END
All
2
1
1