' {$STAMP BS1} '>TinyTim DLB 20-5-94 READ 255,B0 :DEBUG B0 'b0=4 =first byte used, ie. 2 => 0 and 1 free 'History '------- '30-9-05 TINYTIM.BAS loaded into Stamp Editor 2.2 and re-formated to suit it =>TINYTIM.BS1 ' no code changes. '14-4-97 tidyed, keywords now in uppercase '9-4-97 Tiny Tim's Hg cells (4.05v) changed to Ag cells (4.5v) '29-7-96 bump L was 42 now 40, Song2 was for 3 now 2 'Notes '----- '0-Rmf 1-Rmb 2-Lmf 3-Lmb 4-whiskers 5-speaker 6-eyeR 7-eyeL 'm-motor f-forward b-backward R-right L-left 'bump sensors -: Rf-4k7 Lf-10k Rr-22k Lr-47k 'f-front r-rear 'random reversing time 'revtime' in Song3 avoids repeated bump/reverse 'w0 b1 FOR counter i b0 temp for prog size 'w1 b3 POT darkL b2 POT bump, darkR 'w2 b5 dark gradient b4 'w3 b7 b6 movemask 'w4 b9 explore counter b8 frustrated counter 'w5 RANDOM freewill b11 revtime b10 randmove 'w6 GOSUB 'motorRB pin0 'motorRF pin1 'motorLB pin2 'motorLF pin3 SYMBOL whiskers =4 'Pin4 SYMBOL spkr =5 'Pin5 speaker SYMBOL eyeR =6 'Pin6 right LDR SYMBOL eyeL =7 'Pin7 left LDR SYMBOL i =B1 'FOR counter SYMBOL bump =B2 SYMBOL darkR =B2 'right eye light level SYMBOL darkL =B3 'left eye light level SYMBOL deltadark =B5 'darkness gradient between left and right eyes SYMBOL movemask =B6 '%1010=>motors forward only SYMBOL frust =B8 'frustrated level SYMBOL explores =B9 'explore counter SYMBOL randmove =B10 'random value for motor pins gives random move SYMBOL revtime =B11 'reverse time in Song3 for avoid SYMBOL freewill =W5 'RANDOM SYMBOL bumpscale =55 'adjust so b2 unbumped is 33, b2 prop to scale SYMBOL wfront =150 'threshold for both front whiskers hit SYMBOL wright =70 'threshold for right front whisker hit SYMBOL wleft =40 'threshold for left front whisker hit ' can't reliably tell which rear whisker is hit so don't try SYMBOL nobump =34 'threshold for bumping SYMBOL lightscale =100 SYMBOL bright =50 'black is 255, incandescent is 0 SYMBOL evendark =20 'minimum difference between eyes for action SYMBOL exploremax =6 'explore loops+1 before new move SYMBOL frustrated =50 'wfront THEN avoidLR 'bumped both front whiskers IF bump>wright THEN avoidR 'bumped front right whisker IF bump>wleft THEN avoidL 'bumped front left whisker movemask =%1010 GOTO newmove 'must be at rear so avoid rear eyes: POT eyeR,lightscale,darkR POT eyeL,lightscale,darkL DEBUG #darkL,#darkR,CR 'cmnd only takes 2 bytes! IF darkR>darkL THEN darkright darkleft: deltadark =darkL -darkR IF deltadark