' buzzlcd.bs2 ' Buzz the speaker at a given tone based on the pot input, and display ' the value being used on the LCD. ' ' The speaker is connected to pin 7 ' The RC network is connected to pin 8 ' The serial LCD connection is on pin 9 ' ' NOTE: The LCD must be set to work on 2400 baud. ' ' THIS IS CODE FOR A BASIC STAMP II ONLY!! ' ' Mark Crosbie January 1998. mark@mastincrosbie.com ' These are some predefined constants for controlling the LCD LCDPREFIX con 254 LCDCLS con 1 LCDHOME con 2 LCDBLANK con 8 LCDSCRLLEFT con 24 LCDSCRLRT con 28 N24N con 16780 result var word dir9 = 1 ' set the LCD pin to output dir7 = 1 ' set the speaker pin to output serout 9,N24N,[LCDPREFIX, LCDCLS] ' clear the LCD loop: high 8 ' charge the capacitor pause 10 ' wait for it to charge rctime 8,1,result ' do the RC timing freqout 7,10,result * 3 ' buzz the speaker serout 9, N24N, [dec ? result] ' display the result serout 9, N24N, [" "] ' display some blanking text pause 10 serout 9,N24N, [LCDPREFIX, LCDHOME] ' home the cursor goto loop