' LOOKUP.BS1
' 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 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
        
NOTE: The example below is written for the BS2 and will run on any of the BS2-family modules. Modify the $STAMP directive (as required) before downloading to the BS2e, BS2sx, BS2p, BS2pe, or BS2px.
' 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
        
        BASIC Stamp Help Version 2.5.4
Copyright © Parallax Inc.
8/8/2012