I tried setting up the Arduino to sense sounds (as described in the "Knock" example on the site). At first, it kept registering the analogRead() as 1023 everytime, but now it just registers it as 0 everytime. I don't know what I did to change it, or what I did wrong either time.
It depends on how you wired it up. You don't actually say what you did and what other components you used.
Have you tried using a pot to see if your analogue input is still OK?
I have the negative and positive wires of the piezo going through a 1 megohm resistor and then the negative wire is grounded, and the positive wire is in the analog input pin 0.
You should be aware that a piezo kan spit out pretty high voltages you should have a zener diode to cut them of like this arduino / piezo circuit:
http://todbot.com/blog/2006/10/29/spooky-arduino-projects-4-and-musical-arduino/
I have now tried everything, and figured out a couple of things:
- When nothing is plugged into the Analog input, it spits out random numbers for the analogRead()
- It will always read 0 when grounded, just as it will always be 1023 when it's receiving 5v.
- Resistors and the zener diode do not change the numbers it reads when both are plugged into the input - as the link above did.
I am still not sure why it isn't working, and any help would be appreciated.