Tuesday, September 30, 2008

piezo buzzer input / output

we set up a system using piezo buzzers as both input and output. the input uses the piezo crystal's vibration sensor to trigger the output to make a noise. we had some difficulties finding the right code, and in the end, we were able to use another group's "touch sensor" program as a generic place to start. 

Here's the code:
' {$STAMP BS2}
' {$PBASIC 2.5}
TriggerPin PIN 0 ' Input Pin
Main:

LOW 15
IF TriggerPin = 0 THEN buzzit ' Check for trigger, if pressed turn on buzzer
DEBUG "off", CR ' show off
PAUSE 1000
GOTO Main ' loop
buzzit:
DEBUG "buzzIT", CR
HIGH 15 ' turn on piezo buzzer at pin 15
PAUSE 4000
GOTO Main ' loop


we were expecting the output buzzer to only trigger when the input was activated, however, this code seems to treat the input as more of an on/off switch.


the output buzzer also displayed some behavior that we're not quite able to explain. moving/touching the output was somehow disrupting the circuit and producing a strange/interesting noise effect. 



Leigha Dennis, Adam Brillhart, Eunsuk Bae, KoKo

Labels: , , , , ,


Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?