' 10-Tone roger beep for CB radios ' PICAXE-08M start: let b1=1 'set b1 to play1, no tone is played goto main main: pause 10 if input3=0 then out 'if PTT is pressed then goto out loop pause 10 if input4=0 then settone 'if switch pressed then select a tone goto main 'loop back to main settone: high 1 'turn on led for 1.5 seconds pause 1500 'indicates in tone setting mode low 1 'turn led off goto toneset1 toneset1: let b1=1 'let b1 = play1 if input4=1 then toneset2 goto toneset1 toneset2: if input4=0 then toneset 'press switch to select next tone if input3=0 then main 'go back to main loop when PTT is pressed and released goto toneset2 toneset: high 1 'turn on led for 1/2 second pause 400 'to indicate switch has been pressed let b1=b1+1 'add 1 to value of b1 low 1 'led off go back to switch loop if b1> 11 then ledflash goto toneset2 ledflash: pause 500 'flash led to indicate error in programinng tone for b0 = 1 to 20 high 1 pause 150 low 1 pause 150 next b0 pause 500 goto start 'go back to start and reset b1 to play1 out: high 0 'turn on led and PTT transistor high 1 'loop until PTT is released if input3=1 then beep goto out beep: if b1=1 then play1 'play = value of b1 if b1=2 then play2 if b1=3 then play3 if b1=4 then play4 if b1=5 then play5 if b1=6 then play6 if b1=7 then play7 if b1=8 then play8 if b1=9 then play9 if b1=10 then play10 if b1=11 then play11 goto beep play1: goto outtone 'play1 = off play2: tune 0,7,($41) 'play2 = single beep goto outtone play3: tune 0,7,($52) 'play3 = single beep goto outtone play4: tune 0,7,($55) 'play4 = single beep goto outtone play5: tune 0,7,($57) 'play5 = single beep goto outtone play6: tune 0,8,($4A) 'play6 = single beep goto outtone play7: tune 0,7,($42,$47) 'play7 = double beep goto outtone play8: tune 0,4,($50,$47,$50) 'play8 = triple beep goto outtone play9: tune 0,3,($27,$28,$2A,$23) 'play9 = short tune goto outtone play10: 'play10 = musical tone tune 0,2,($27,$6C,$6C,$C0,$6C,$40,$6C,$00) goto outtone play11: 'play11 = musical tone tune 0,5,($24,$26,$27,$69,$2B,$6B,$29,$27,$26) goto outtone outtone: pause 10 'turn off led and PTT transistor low 0 low 1 goto main 'go back to main loop