KEYPAD

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
wayne millard
Posts: 234
Joined: Thu May 31, 2007 2:18 pm
Has thanked: 7 times
Been thanked: 12 times

KEYPAD

Post by wayne millard »

Can you wright a number to a variable larger than 11 with the keypad.
I would like type numbers in like a calculator and then read number :D

User avatar
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:

Post by Benj »

Hello Wayne

Yes this can be acheived. The easiest way is probably to convert the incoming numbers from the keypad into a string.

To do this first create a string variable and two byte variables in flowcode. The variables should be named string_var, index_var and keypad_var.

Firstly initialise the index variable to 0 and set up a loop. The loop can be a specific number of cycles or can run until a certain key is pressed on the keypad.

Inside the loop you should read the keypad ascii into a variable.

If the data in the variable is valid (if a key has been pressed) then create a calculation with the following.

string_var[index_var] = keypad_var

Then increment the index variable.

Once your string is as long as you want then exit the loop and you have your string of number characters. This can the be output to the LCD using the PrintString function.

Post Reply