chapter8/CH8PRG9.LST:

1 REM THIS IS A BASIC PROGRAM TO CONTROL THE RATE OF A METRONOME
2 REM 
3 REM 
5 PRINT "}":REM CLEAR SCREEN
10 X=10:REM INITIAL VALUE FOR RATE
20 FOR J=1 TO 10:NEXT J:REM SOFTWARE DELAY LOOP
50 IF STICK(0)=14 THEN X=X+1:REM STICK FORWARD MEANS SPEED UP RATE
51 IF STICK(0)=13 THEN X=X-1:REM STICK BACK MEANS SLOW METRONOME RATE
52 IF X<1 THEN X=1:REM NEVER GO BELOW ONE
53 IF X>255 THEN X=255:REM OR ABOVE 255
54 REM PRINT BEATS/MINUTE
56 ? "";INT(3600/X);" BEATS/MINUTES      "
60 POKE 0,X:REM LOCATION $0000 HOLDS THE RATE FOR
70 NEXT I:REM THE FOLLOWING ASSEMBLY ROUTINE

Back to previous page