problem programming a keypad
Moderator: Benj
- Francisco Cabrera
- Posts: 47
- Joined: Sat Mar 19, 2016 4:56 pm
- Location: Canary Island
- Has thanked: 23 times
- Been thanked: 7 times
- Contact:
problem programming a keypad
Hello, good evening, I have a problem programming a keypad, In the photo I have touched the number 12 but the number appears 01 .... Can I solve this?
- Attachments
-
- capturada.jpg (185.21 KiB) Viewed 9910 times
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: problem programming a keypad
Please read this post. One of the items is a request to post the flowchart with issues as it helps us understand what you are doing. A screen capture of a flowchart is NOT a flowchart as it lacks a lot of information.
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
- Francisco Cabrera
- Posts: 47
- Joined: Sat Mar 19, 2016 4:56 pm
- Location: Canary Island
- Has thanked: 23 times
- Been thanked: 7 times
- Contact:
Re: problem programming a keypad
Ok. your you have reason, excuse, he will remember it for another occasion ,He sent the fcfx ... thank you
- Attachments
-
- Flowcode keypad ok.fcfx
- (6.6 KiB) Downloaded 276 times
- Francisco Cabrera
- Posts: 47
- Joined: Sat Mar 19, 2016 4:56 pm
- Location: Canary Island
- Has thanked: 23 times
- Been thanked: 7 times
- Contact:
Re: problem programming a keypad
I have tried modifying all the parameters of configuration and I do not obtain it, please someone can help me? Thank you.........
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: problem programming a keypad
Hi,
There is a difference in the meaning of the return value for these macros.
The WaitPressed() returns the index (or scan code) for the key, the same as GetIndex()
The GetNumber() converts the scan code into a key number and returns that instead.
Leigh
There is a difference in the meaning of the return value for these macros.
The WaitPressed() returns the index (or scan code) for the key, the same as GetIndex()
The GetNumber() converts the scan code into a key number and returns that instead.
Leigh
- Francisco Cabrera
- Posts: 47
- Joined: Sat Mar 19, 2016 4:56 pm
- Location: Canary Island
- Has thanked: 23 times
- Been thanked: 7 times
- Contact:
Re: problem programming a keypad
After many hours, I have advanced enough............ Only I need to learn how I can compare the number written in the LCD with a number written in a variable? Please can you help my? please
- Attachments
-
- Flowcode keypad ...fcfx
- (8.09 KiB) Downloaded 296 times
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: problem programming a keypad
Hi
If you are wanting to compare with more than one key press, example for a pin number lock,
you will need to either put each key pressed into a string array, then compare the array with the lock code, e.g. "1234"
Or, you could calculate the lock number, like so...
If you are wanting to compare with more than one key press, example for a pin number lock,
you will need to either put each key pressed into a string array, then compare the array with the lock code, e.g. "1234"
Or, you could calculate the lock number, like so...
Code: Select all
code = 0
loop
key = getAscii()
if key <> 255
code = (code * 10) + key - '0'
if code = 1234
code OK
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: problem programming a keypad
I created a flowcode V5 simple door lock.
That could also give you an idea on how to compare entered numbers with a number stored within a variable.
You can load it into flowcode V6 by using Open, then changing Flowcode project files (*.fcfx) drop down to Flowcode for pic files (*.fcf)
Martin
That could also give you an idea on how to compare entered numbers with a number stored within a variable.
You can load it into flowcode V6 by using Open, then changing Flowcode project files (*.fcfx) drop down to Flowcode for pic files (*.fcf)
Martin
Martin
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: problem programming a keypad
Hi,
I have simplified the flowchart for you.
You can use * to clear.
When number matches the stored variable, LED changes from red to green.
Martin
I have simplified the flowchart for you.
You can use * to clear.
When number matches the stored variable, LED changes from red to green.
Martin
- Attachments
-
- Flowcode keypad 2.fcfx
- (11.08 KiB) Downloaded 307 times
Martin
- Francisco Cabrera
- Posts: 47
- Joined: Sat Mar 19, 2016 4:56 pm
- Location: Canary Island
- Has thanked: 23 times
- Been thanked: 7 times
- Contact:
Re: problem programming a keypad
Now I understand it much better, many graces, only I have one doubts, them in the photo... Please, forgive my ignorance, Everything else if I understand it well
- Attachments
-
- capturada.jpg (145.22 KiB) Viewed 9777 times
Last edited by Francisco Cabrera on Fri May 27, 2016 3:28 pm, edited 1 time in total.
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: problem programming a keypad
Hi,
Martin
What photo?Francisco Cabrera wrote:only I have one doubts, them in the photo.
Martin
Martin
- Francisco Cabrera
- Posts: 47
- Joined: Sat Mar 19, 2016 4:56 pm
- Location: Canary Island
- Has thanked: 23 times
- Been thanked: 7 times
- Contact:
Re: problem programming a keypad
Excuse I was modifying the photo, because before I tape-worm 2 doubt, and now alone I have only one....
- Attachments
-
- capturada.jpg (145.22 KiB) Viewed 9774 times
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: problem programming a keypad
for the first one
RESULTADO = RESULTADO * 10 + numero_teclado
for example if RESULTADO starts off = 0
If you press 1 on the keypad
0 x 10 +1 = 1
then 1 is stored in RESULTADO
If 2 is now pressed then:
1 x 10 + 2 = 12
Now if 3 is pressed
12 x 10 + 3 = 123
So the number stored before pressing a number on the keypad is multiplied by 10 then the key pad number is added to the result.
The lower one is just a decision branch.
In English:
Is the number stored in a variable called abre = result entered in the keypad?
If Yes then set port C bit 2 high and bit 1 low
If No then port C bit 1 high and bit 2 low
Martin
RESULTADO = RESULTADO * 10 + numero_teclado
for example if RESULTADO starts off = 0
If you press 1 on the keypad
0 x 10 +1 = 1
then 1 is stored in RESULTADO
If 2 is now pressed then:
1 x 10 + 2 = 12
Now if 3 is pressed
12 x 10 + 3 = 123
So the number stored before pressing a number on the keypad is multiplied by 10 then the key pad number is added to the result.
The lower one is just a decision branch.
In English:
Is the number stored in a variable called abre = result entered in the keypad?
If Yes then set port C bit 2 high and bit 1 low
If No then port C bit 1 high and bit 2 low
Martin
Martin
- Francisco Cabrera
- Posts: 47
- Joined: Sat Mar 19, 2016 4:56 pm
- Location: Canary Island
- Has thanked: 23 times
- Been thanked: 7 times
- Contact:
Re: problem programming a keypad
Medelec, thank you very much, you have gained my friendship forever, because I see that you are a good person for having bothered to help me so much ... I expect some day to be able to return the favor to you .... thank you