' ========================================================================= ' ' File....... SW21-EX04-Runway_LEDs.BS2 ' Purpose.... Advanced LED Flasher ' Author..... (C) 2000 - 2005, Parallax, Inc. ' E-mail..... support@parallax.com ' Started.... ' Updated.... 01 SEP 2005 ' ' {$STAMP BS2} ' {$PBASIC 2.5} ' ' ========================================================================= ' -----[ Program Description ]--------------------------------------------- ' ' "Ping-Pongs" a single LED back-and-forth across a bank of eight. This ' program will work, unmodified, on any BS2-family module. ' -----[ I/O Definitions ]------------------------------------------------- LEDs VAR OUTL ' LEDs on P0 - P7 LEDsDirs VAR DIRL ' DIRS control for LEDs ' -----[ Constants ]------------------------------------------------------- DelayTm CON 100 ' delay time for lit LED ' -----[ Initialization ]-------------------------------------------------- Reset: LEDsDirs = %11111111 ' make LEDs outputs ' -----[ Program Code ]---------------------------------------------------- Main: LEDs = %00000001 ' start with right LED on DO PAUSE DelayTm ' on-time for lit LED LEDs = LEDs << 1 ' shift LED left LOOP UNTIL (LEDs = %10000000) ' test for last LED GOTO Main