I'm making a calculator (on tinkercad for strting) and like the title and what you can see in the linked picture there is a strange "probleme" ? Could somme one help me ?
Probably something like --
lcd.print (nombre1.toInt());
lcd.print (" + ");
lcd.print (nombre2.toInt());
lcd.print (" = ");
lcd.print (result);
As you can see from the above answer print takes one argument.
Your code calculates the answer and puts it in "result".
The next line calculates the answer correctly inside the print and prints the correct answer 1061. The answer is one argument - the answer.
Then you print spaces and result combined and get 1000.
To debug you eliminate possibilities. Is the problem with the calculation of result, was it the definition of result (which is not shown) or with the syntax in the print statement?
Print just result in one print like above.
Serial.print result and look in the serial monitor. Is the answer inside result correct?
Report back when you figure it out so other people don't waste time answering for no reason.
Is 'result' an integer or a String? If it is an integer, you can't make anything useful by adding it to a string constant: " " + result
If it is an integer, use:
lcd.print(" ");
lcd.print(result);
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.