im building a code just like a calcu. but the problem is i dont know how wil I assign a keypad ex '*' as
negative and other key for decimal because i want to input (0.001 or other value)
When you've fixed the shift-lock and your '!' keys, get back to us with the code you've got so far.
When you post code, use [code][/code] tags
What does your code currently look like? Building a string of digits would make it easy to convert the string to a value. The string could be "-23" or "0.002" or "-0.00383734". The question is how do you distinguish between the unary - (the value is negative) and the binary - (one value is to be subtracted from another). Another question is how do you determine when a string is complete and needs to be converted to a value.
void setup ()
{
Serial.begin(9600);
}
void loop ()
{
customKey = kypd.waitForKey();
switch(customKey)
{
case 'A':
Serial.println("input Ax");
A=getnum('A');
break;
case 'B':
same with A
case 'C':
same with A
case 'D':
same with A
case '1':
Serial.println("input tol:"); //////// I must Input decimal like 0.05
tol=getnum('1');
break;
}
}
float getnum(char _a){
long num1;
long num = 0;
do{
customKey = kypd.waitForKey();
switch(customKey)
{
case '0' ... '9':
if(num1 - 999.999 > 0 ) //// I can't fully understand this code
break;
num =num * 10 + (customKey - '0');
num1=num;
Serial.print(first);
break;
default:
break;
}
}while(customKey != '#');
Serial.println("save");
Serial.println(_a);
return num;
}