high pwrLED 'just so we know the stamp's working
main:
high potPin 'put voltage out to the capacitor
pause 1 'hold a millisecond (0.4 ms on the BS2-SX)
rctime potPin, 1, potVar 'time how long the cap takes to discharge
debug ?potVar
byteVar = potVar /3 'convert potvar to a smaller number
pwm LED2, byteVar, 10 'output a varying voltage based on bytevar
freqout spkrPin,10,byteVar*50 'make a varying sound on the speaker
debug ?byteVar
goto main
Schematic: