'{$STAMP BS2} '------------------------------------------ 'tsounds.bs2 ' 'This program uses temperature to control sound. 'Experiment with the snd constants to change response. temp var word 'Temperature ontime var word 'Sound on time sndf var word 'Sound frequency delayt var word 'Delay between sound snd1 con 2 'Time on constant snd2 con 10 'Frequency constant snd3 con 1 'Delay constant start: freqout 9,100,1500 'Beep pause 50 'Delay between beeps freqout 9,100,1500 'Beep pause 2000 'Delay before starting snd: gosub gett 'Read the temperature temp=temp*42/100 'Adjust value to 1 byte ontime = temp*snd1 'Sound on time sndf = temp*snd2 'Sound frequency delayt = temp*snd3 'Delay between sound freqout 9,ontime,sndf 'Make the sound pause delayt goto snd 'Continue forever '------------------------------------------ 'gett 'Reads the temperature and sets variable temp gett: high 3 'Discharge cap pause 1 'Short delay rctime 3,1,temp 'Capture temperature return 'Done