Double tap on/off with piezo

Probably a newb question, but Imma newb, so ::shrug::

Trying to program a circuit that uses a piezo to turn a led on and off. I want to have a double tap on/off function to avoid accidental on/off events. So, 2 taps within a second or so make the light go on, or off. I can’t quite grok how to make the code do this. I think I could do it with some GOTOs, but I’m trying to learn and not kludge together a pile of crap, and I’ll probably adding other features onto this project.

I got the classic piezo tutorial working great, got mosfets driving a blinding 5W LED, woo! But now I’m stuck.

I found some some stuff on how to do it with an accelerometer on here, but I can’t translate it into using a piezo. It seems maybe interrupts are involved, but I got lost trying to figure those out. >_<
Thanks all!

Should this go in programming section? Was unsure of the best fit.

Try entering "clap switch" in the search box on top of this page.

You will find threads like this one.