Go Down

Topic: 4 button passcode lock program? (Read 408 times) previous topic - next topic

DKNMSIS

Dec 11, 2012, 06:50 pm Last Edit: Dec 11, 2012, 06:53 pm by DKNMSIS Reason: 1
OK, so I have all the hardware and chips set out. I just have to figure out how to write the program for what i have in mind.

[setup]
red led
green led
12V motor with H bridge controller that i will use to drive the lock forwards or backwards
4 push buttons on the outside of the door
1 switch on the inside of the door
two limit switches inside the lock to detect if it is open or closed


[function]
the first button will also be a initialize button
you will use the 4 buttons to enter in a hardcoded passcode( ie. 1, 1.4.4.2.3    or 1, 2.2.3.3.4)

if the code is entered correctly, it will wait for the [unlock] limit switch within a duration and blink the green led for 3s
if the code is entered correctly and the correct limit switch is not hit, a red led will shine solidly
if the code is incomplete for x.xs then the system will uninitialize and go back to standby

if the code is entered in wrong, the red led will blink.
if the code is entered in wrong 3 times then the system will hold red light and become unresponsive for 15 minutes

the last button acts as a lock when you exit the house,
hold it for 3s and the door will wait for the [lock] limit switch within a certain duration and blink the red and green leds in a pattern
if the [lock] limit switch hasnt been hit within x.x s then rapidly blink red led for 10s
the switch inside the door will unlock the door when held for 2s and lock when tapped once or pressed for under 1s

also there will be a test mode if the inside switch is held for 5s and it will test the leds and lock and display green or red solidly depending on test


I'm activly reading up on C++ and trying to learn from the examples of code, but this is completely new to me so It all seems vary intimidating. I would love to learn as much as i can while working on this project but I'm just not sure where to start or how.

any help or advice would be appreciated



Arrch


any help or advice would be appreciated


Don't try and write the code all at once. Start small; get the hardware working. Build up from each step, making sure that each section is working before adding more code and complexity to the project.

Go Up