' Piezo Contact Dection - Using BS2 "Freqout" Detect Objects ' ' For the BASIC Stamp 2 ' Uses an ADC081 serial ADC '{$STAMP BS2} '{$PBASIC 2.5} AdreSS VAR Byte ' A-to-D result: one byte CS CON 13 ' Chip select is pin 13 Adata CON 14 ' ADC data output is pin 14 CLK CON 15 ' Clock is pin 15 Vref CON 0 ' VRef HIGH Vref HIGH CS ' Deselect ADC to start DO LOW CS ' Activate ADC SHIFTIN AData, CLK, MSBPOST, [ADres\9] ' Shift in the data HIGH CS ' Deactivate ADC DEBUG ? Adres ' Display result PAUSE 100 ' Wait 1/10 second LOOP ' Repeat