Could you please give me a hint?
Ok, yeah, I saw that. I'll download your example and let you know what I think.Just out of curiosity, what's the application for this?
Can you show the piezo and the circuitry around it? Would be hard to check without knowing that.
Ok... So after looking over your example code, I think the easiest thing will be to leave it essentially as-is, but check the collected knock pattern against both (or more) secret code patterns and return a code associated with the pattern that matches.