system
September 25, 2014, 6:08am
1
I have a trouble while converting char to int value .. char variable contains (+) operator which make this problem
the result in serial monitor is 40 =( .. i need it to be 100
thanks in advance
char sum[]="40+60";
void setup()
{
Serial.begin(9600);
}
void loop()
{
int number = atoi(sum);
Serial.println(number);
delay(1000);
}
atoi doesn't do arithmetic.
What are you really trying to do here?
system
September 25, 2014, 7:11am
3
i want convert this char "40+60" to a final value (100)
"40+60" will be generated from voice recognition arduino shield
system
September 25, 2014, 8:05am
4
You need to parse the expression.
Reverse-Polish might be an easier task, if expressions get any more complex.
system
September 25, 2014, 8:24am
5
AWOL:
You need to parse the expression.
Reverse-Polish might be an easier task, if expressions get any more complex.
what's reverse polish ?? :~
system
September 25, 2014, 8:37am
6
what's reverse polish ??
This is NOT the "google it for me" hotline. Do it yourself!
westfw
September 25, 2014, 9:09am
7
JimboZA
September 25, 2014, 9:13am
8
MohammedS:
AWOL:
You need to parse the expression.
Reverse-Polish might be an easier task, if expressions get any more complex.
what's reverse polish ?? :~
Hewlett-Packard calculator fans will remember.....
AWOL:
Reverse-Polish might be an easier task, if expressions get any more complex.
However 40+60 isn't Reverse Polish.
MohammedS:
i want convert this char "40+60" to a final value (100)
"40+60" will be generated from voice recognition arduino shield
Can you recognize "40"?
Can you recognize "60"?
Can you recognize "plus"?
Can you add (hehe) all that together?
JimboZA
September 25, 2014, 9:30am
11
Indeed, that would be 40 Enter 60 +
(There's a clue, MohammedS)