BASIC stamp manual v2.2
LOOKUP – BASIC Stamp Command Reference
Page 280 • BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com
' {$STAMP BS1}
' {$PBASIC 1.0}
SYMBOL idx = B2
SYMBOL frame = B3
Spinner:
LOOKUP idx, ("|/-\"), frame ' lookup current frame character
DEBUG CLS, "Spinner: ", #@frame ' display
idx = idx + 1 // 4 ' update frame index (0..3)
GOTO Spinner ' loop forever
END
Demo Program (LOOKUP.bs2)
' LOOKUP.bs2
' This program uses LOOKUP to create a Debug-window animation of a spinning
' propeller. The animation consists of the four ASCII characters | / - \
' which, when printed rapidly in order at a fixed location, appear to spin.
' A little imagination helps a lot here....
' {$STAMP BS2}
' {$PBASIC 2.5}
idx VAR Nib
frame VAR Byte
Spinner:
DO
LOOKUP idx, ["|/-\"], frame ' lookup current frame character
DEBUG HOME, "Spinner: ", frame ' display
PAUSE 150 ' pause between frames
idx = idx + 1 // 4 ' update frame index (0..3)
LOOP ' loop forever
END
All
2
NOTE: This example program can be
used with all BS2 models by changing
the $STAMP directive accordingly.