Hi All,
This is the first time I have ventured into App Developer and I am struggling a bit. I am trying to simply enter a number using a keypad, display it on the 7 segment displays and send it out of the com port.
So this might be a daft question and I am missing the obvious, but how do you tell when a key has been pressed on the number pad? I have attached a screenshot of the options available to me and I don't have anything to indicate a key has been pressed. Using the simulation, If I read the keypad buffer in a loop it only seems to output a 0 even if the buttons are pressed and held down.
I have attached the flow chart.
As I say apologies if I am missing the obvious here, this seems like it should be so simple, but I have been deliberating over this for quite a while and getting nowhere. Any help would be appreciated.
Many Thanks.
Simon.
Number Pad
-
simon-sandtcontrols
- Posts: 58
- http://meble-kuchenne.info.pl
- Joined: Sun Mar 21, 2021 3:56 pm
- Has thanked: 9 times
- Been thanked: 11 times
Number Pad
- Attachments
-
- UART Setup App V1_0.fcsx
- (15.27 KiB) Downloaded 20 times
-
- Screenshot 2026-04-01 175235.jpg (15.57 KiB) Viewed 150 times
-
mnfisher
- Valued Contributor
- Posts: 1895
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 154 times
- Been thanked: 893 times
Re: Number Pad
It's less easy than it should be....
One way - get the string input (GetInputString) - 'pressing' Enter on the keypad is returned as character '\n' (0x0a) - if this is received then set the display and 'clear' the input buffer.
In a similar vein - the 'EditBox' - doesn't seem to have any way to read the contents at all
Martin
One way - get the string input (GetInputString) - 'pressing' Enter on the keypad is returned as character '\n' (0x0a) - if this is received then set the display and 'clear' the input buffer.
In a similar vein - the 'EditBox' - doesn't seem to have any way to read the contents at all
Martin
-
mnfisher
- Valued Contributor
- Posts: 1895
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 154 times
- Been thanked: 893 times
Re: Number Pad
I changed tack slightly and used GetLastChar - looking for '\n' - here I just display the value (using a numeric indicator) - and clear the current entry on 'enter'.
Not very elegant - left all my 'working' in (although disabled) - to show how I looked at the returned data.
Martin
Not very elegant - left all my 'working' in (although disabled) - to show how I looked at the returned data.
Martin
- Attachments
-
- keypad.fcpcd
- (20.37 KiB) Downloaded 18 times
-
simon-sandtcontrols
- Posts: 58
- Joined: Sun Mar 21, 2021 3:56 pm
- Has thanked: 9 times
- Been thanked: 11 times
Re: Number Pad
Thanks Martin,
I am glad it wasn't only me that didn't find this very intuitive.
I am not sure what file format the .fcpcd is, but Flowcode 10 won't recognise it, so I can't look and see what you have done.
It set me thinking that I have used the keypad in the embedded code, on a PIC a number of times with no problem, but that always returns a 12 if no buttons are pressed, so you simply use a loop to grab a button press.
My intention when I started out with this was to display the number of the button pressed on the 7 segment mimic, once the number intended was entered, press the enter key to send the value. If we can only read the buffer on detection of the enter key, this isn't going to be possible. What you described set me thinking, I could do it by not clearing the buffer, then simply look for a change in the last number pressed, then it dawned on me that was great until you enter 100 or 99.... etc.
I am starting to think there is part of the component missing here, it feels like it needs something like the embedded keypad that you can read to let you know a button had been pressed.
Maybe one of the Matrix team could help us with an example of how they intended it to be used, please?
Simon.
I am glad it wasn't only me that didn't find this very intuitive.
I am not sure what file format the .fcpcd is, but Flowcode 10 won't recognise it, so I can't look and see what you have done.
It set me thinking that I have used the keypad in the embedded code, on a PIC a number of times with no problem, but that always returns a 12 if no buttons are pressed, so you simply use a loop to grab a button press.
My intention when I started out with this was to display the number of the button pressed on the 7 segment mimic, once the number intended was entered, press the enter key to send the value. If we can only read the buffer on detection of the enter key, this isn't going to be possible. What you described set me thinking, I could do it by not clearing the buffer, then simply look for a change in the last number pressed, then it dawned on me that was great until you enter 100 or 99.... etc.
I am starting to think there is part of the component missing here, it feels like it needs something like the embedded keypad that you can read to let you know a button had been pressed.
Maybe one of the Matrix team could help us with an example of how they intended it to be used, please?
Simon.
-
Steve-Matrix
- Matrix Staff
- Posts: 1819
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 263 times
- Been thanked: 421 times
Re: Number Pad
I think you could change the extension to .fcsx and then it should load into Flowcode v10.simon-sandtcontrols wrote: ↑Thu Apr 02, 2026 8:32 amI am not sure what file format the .fcpcd is, but Flowcode 10 won't recognise it, so I can't look and see what you have done.
-
mnfisher
- Valued Contributor
- Posts: 1895
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 154 times
- Been thanked: 893 times
Re: Number Pad
Thanks Steve,
Sorry - I hadn't noticed that the file extensions had changed in v11 - I can re-do in v10 if changing the file extension doesn't do the trick....
Martin
Sorry - I hadn't noticed that the file extensions had changed in v11 - I can re-do in v10 if changing the file extension doesn't do the trick....
Martin
-
simon-sandtcontrols
- Posts: 58
- Joined: Sun Mar 21, 2021 3:56 pm
- Has thanked: 9 times
- Been thanked: 11 times
Re: Number Pad
Hi Steve,
That's great, that worked, thanks. Flowcode 10 gave a warning about it being written in a later version, but it all worked anyway.
Martin,
That's got it, brilliant, thanks. I hadn't found the numeric indicator, and I have just checked, it doesn't exist in Flowcode 10, so that's why!! I see how you've done it now, and that works perfectly for what I need, I can just add the send via Com port to the branch where it clears the buffer.
Thanks again for the help.
Simon.
That's great, that worked, thanks. Flowcode 10 gave a warning about it being written in a later version, but it all worked anyway.
Martin,
That's got it, brilliant, thanks. I hadn't found the numeric indicator, and I have just checked, it doesn't exist in Flowcode 10, so that's why!! I see how you've done it now, and that works perfectly for what I need, I can just add the send via Com port to the branch where it clears the buffer.
Thanks again for the help.
Simon.
-
simon-sandtcontrols
- Posts: 58
- Joined: Sun Mar 21, 2021 3:56 pm
- Has thanked: 9 times
- Been thanked: 11 times
Re: Number Pad
Hi All,
OK, retract the I can't find the number indicator in Flowcode 10, it's under the "Creation" menu, I was looking in the "indicators" menu!! The Edit box is in there as well.
Thanks.
Simon
OK, retract the I can't find the number indicator in Flowcode 10, it's under the "Creation" menu, I was looking in the "indicators" menu!! The Edit box is in there as well.
Thanks.
Simon