' ========================================================================= ' ' File....... Random_1_To_5.BS2 ' Purpose.... ' Author..... Jon Williams -- Parallax, Inc. ' E-mail..... jwilliams@parallax.com ' Started.... ' Updated.... 18 FEB 2005 ' ' {$STAMP BS2sx} ' {$PBASIC 2.5} ' ' ========================================================================= ' -----[ Program Description ]--------------------------------------------- ' -----[ Revision History ]------------------------------------------------ ' -----[ I/O Definitions ]------------------------------------------------- StartButton PIN 0 ' -----[ Constants ]------------------------------------------------------- Up CON 1 ' for active-low button Down CON 0 ' -----[ Variables ]------------------------------------------------------- rndSeed VAR Word strtDelay VAR Nib ' -----[ EEPROM Data ]----------------------------------------------------- ' -----[ Initialization ]-------------------------------------------------- Reset: ' -----[ Program Code ]---------------------------------------------------- Main: DO WHILE (StartButton = Up) RANDOM rndSeed LOOP strtDelay = (rndSeed / 13108) + 1 ' make 1 to 5 DEBUG "Start Delay = ", DEC strtDelay, CR DO : LOOP UNTIL (StartButton = Up) GOTO Main END ' -----[ Subroutines ]-----------------------------------------------------