They say that piezos have polarity, but the one I have doesn't show what it is, or if it has any.
What is polarity?
It is best explained on Wikipedia, but basically it defines a single right way to connect a component to the circuit, depending on the direction of the current flow. Components like resistances don't have polarity, so they can be connected either way. Polarity matters for most electrical objects like diodes (LEDs are diodes) or speakers.
I couldn't find a datasheet to the exact name (PKM22EPP-40) and neither on the manufacturer (muRata) datasheets for similar components.
But after reading this I found the explanation for the reference name (not helpful...).
So I tried the program supplied using a 330K resistance so that I could test for polarity reducing the risk of burning the piezo.
It generated a very low sound either way I connected it.
With a 10K resistance, the sound is louder, but still kind of weird.
Then I tried 470 Ohm and 47 Ohm with the same results.
So I dropped the resistances, and the sound isn't much louder, but still as annoying.
And this piezo has no polarity after all.
(Something wrong with the processing of the video from Blogger that makes the sound out of sync...)
So for the next test I tried this example from Adafruit, and got better results. The sound is clearer, and not as annoying.
The basic difference from the previous example is the use of digitalWrite instead of analogWrite to the piezo.
But what difference does it make? Well that is [TO BE SEARCHED].