Hello and Merry Christmas to everyone.
I've been working on some new features for the Circular Buffer component so thought I would share with everyone the latest component and a working example using the new functionality.
You need to place the attached file above into the following location: "C:\Program Files (x86)\Flowcode 6\components"
Then here is the example file.
The current password is stored in the string at the start of the program, when ever the combination of keys on the keypad match the password the solenoid will fire for 5 seconds. Any other combination of keys will be ignored.
Please note that if anyone wants to have a go at building this then you will need to use a NPN transistor to boost the output current from the microcontroller to drive the solenoid.
Keypad Based Door Lock
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Keypad Based Door Lock
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- AbhijitR
- Posts: 300
- Joined: Fri Nov 07, 2014 12:48 pm
- Location: Pune, India
- Has thanked: 283 times
- Been thanked: 80 times
- Contact:
Re: Keypad Based Door Lock
Hello!
Any idea/pointer how I can make a 4 digit lock but the problem is I am using only 3 keys in my project (Up, Down, Enter) and also one graphic display, my purpose of this lock is to access the programing parameters of my project using the secret 4 digits, but I really do not understand how to start.
I appreciate if someone can give me a start. Thank you in advance.
Regards
Abhi
Any idea/pointer how I can make a 4 digit lock but the problem is I am using only 3 keys in my project (Up, Down, Enter) and also one graphic display, my purpose of this lock is to access the programing parameters of my project using the secret 4 digits, but I really do not understand how to start.
I appreciate if someone can give me a start. Thank you in advance.
Regards
Abhi
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Keypad Based Door Lock
Hello,
The first step will be building up a string using the buttons available to you.
Start by initialising the string to say a known character e.g. 0000 and initialise your array index to 0.
str = "0000"
idx = 0
On an up button press you would increment the value inside location [idx] wrapping at the highest value, in this case '9' wraps back to '0'.
if ( str[idx] < '9' )
str[idx] = str[idx] + 1
else
str[idx] = '0'
For the decrement button do the oppisite, '0' wraps to '9'.
if ( str[idx] > '0' )
str[idx] = str[idx] - 1
else
str[idx] = '9'
For the enter button you move to the next character or for the 4th press perform the compare.
if ( idx < 4 )
idx = idx + 1
else
Compare string against stored string and if matches then perform unlock.
to perform compare you can do this inside a decision. The yes branch is hit if the strings match.
if ( compare$(str, "1234", 0) == 0 )
Are you wanting just numeric entry or alpha characters too?
Do you have a display you can use to display the current string? If you do then simply reposition the cursor and print str when ever a button is pressed.
The first step will be building up a string using the buttons available to you.
Start by initialising the string to say a known character e.g. 0000 and initialise your array index to 0.
str = "0000"
idx = 0
On an up button press you would increment the value inside location [idx] wrapping at the highest value, in this case '9' wraps back to '0'.
if ( str[idx] < '9' )
str[idx] = str[idx] + 1
else
str[idx] = '0'
For the decrement button do the oppisite, '0' wraps to '9'.
if ( str[idx] > '0' )
str[idx] = str[idx] - 1
else
str[idx] = '9'
For the enter button you move to the next character or for the 4th press perform the compare.
if ( idx < 4 )
idx = idx + 1
else
Compare string against stored string and if matches then perform unlock.
to perform compare you can do this inside a decision. The yes branch is hit if the strings match.
if ( compare$(str, "1234", 0) == 0 )
Are you wanting just numeric entry or alpha characters too?
Do you have a display you can use to display the current string? If you do then simply reposition the cursor and print str when ever a button is pressed.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- AbhijitR
- Posts: 300
- Joined: Fri Nov 07, 2014 12:48 pm
- Location: Pune, India
- Has thanked: 283 times
- Been thanked: 80 times
- Contact:
Re: Keypad Based Door Lock
Hi! Ben
good morning
You are incredible, you did exactly the same what I had in my mind, unfortunately I was not able to express/write that, Ben you make things really very easy, my problem solved.
Thank you very much for taking time, have a wonderful weekend, cheers...
Regards
Abhi
good morning
You are incredible, you did exactly the same what I had in my mind, unfortunately I was not able to express/write that, Ben you make things really very easy, my problem solved.
Thank you very much for taking time, have a wonderful weekend, cheers...
Regards
Abhi