Alyssa’s Combination Lock (Week 4)

Goal: Build a combination lock using 2-4 buttons, at least 4 button presses, and LEDs indicating locked vs unlocked status.

Components: jumper wires, 3 buttons, 5 resistors (220 Ohms x 2, 10K Ohms x3), 2 LEDs (different colors), breadboard, arduino

Setup: 3 buttons and 2 LEDs with resistors wired to arduino. When the right combination of buttons is pressed, unlock and shine the green LED. Otherwise, lock and shine the red LED.

How it works:

Starts in a locked status, indicated by red LED.

Enter the following combination of buttons to unlock:
Button 1: 2 presses
Button 2: 1 press
Button 3: 2 presses

This combination unlocks, indicated by green LED.

To lock: press each button once. This triggers each button count to exceed the maximum limitation and thus reset to 0.

Problems: I couldn’t figure out how to have a fourth button that just acts as reset button. I’m sure with a little more time I could get this feature to work.

Link to code:

Leave a Reply

Your email address will not be published. Required fields are marked *