I'm trying to figure out how to get a number from a 12 digit keypad. The user will know that the asterisk key replicates the decimal point.
I'm familiar with getting integers like this:
float theVal;
byte k = checkKeyBuffer(); //get a keypress from the user
if (k >= 0 && k <= 9) { //a digit
theVal = theVal * 10 + k;
}
But I am totally stumped once they press the decimal point. I've searched and searched on the web. It seems this would be a common issue? I'm guessing once the decimal is pressed, I have to trigger a flag to let it know I'm working on the other side of the decimal point. But what to do from there I'm at a loss.
If it helps, the number the user will be entering will be up to 3 digits before the decimal, and 3 digits after the decimal.