Sketch for Arduino Project 12: Knock Lock

It's included with the Arduino IDE. You'll find it (along with the rest of the projects) at File > Examples > 10.StarterKit_BasicKit > p12_KnockLock.