Description of the project:
The goal of this assignment is to build your own combination locker with led and buttons. For me, I want a combination locker which can use keypad numbers as input and can be controlled by my cell phone. So I choose to use 1Sheeld module and it’s application to build my own combination locker.
List of components:
- 1sheeld– a wireless shield which can easily attach to Arduino, with the customized application, you can use your cell phone to control Arduino.
- Arduino Uno x1
- 200-ohm resistor x1
- Red led x1
- jumper wires
How it works:
first of all, attach the 1sheeld to Arduino, and then connect LEDs to the pin assigned. After uploading the code to Arduino and 1sheeld. You can open up Bluetooth to search 1sheeld and connect to it. Then open the keypad shield in the 1sheeld application, enter the password you set to open the lock. In this project, I used red led to indicate “the locker is not opened”, and it was set it to be lighted up as default. When the user enters the right password, the red light should be turned off.
In the code part, using flag function (in here I put “iterations” to represent it ) to set your password. I set the password to “1220”, and every time you press the right keypad the flag will plus one. After fulfilling the 4 iterations (0~3), the red led should turn off.
Because of the flag function, the four-digit password should be checked each time, the wrong input such as “4593”, “2340” will not let the red light go off. See the following code for the details:
Any problems you encountered and/or solved:
My original intention is to use two different led lights, a red one for wrong and a green one for right. But no matter how hard I tried, 1 sheeld seems to not able control two LEDs at all. What I tried to debug including change all the components including the breadboard, LEDs, wires, and different pin. In the end, I only use one led to represent the lock status.