Hello, I have been trying to make my lcd type like a calculator, when I type a number with my keypad it should start from the right and shift to the left everytime I press an operator or number.
The default is left to right.
I correctly shift num1 to go to the left when I keep adding numbers but the operator and num 2 overlap with num1.
Does anybody know how to do this? Thankyou!
if (currentVal == false) {
num1 = num1 + keyPress;
numLen1 = num1.length();
lcdShift = 20 - numLen1;
lcd.setCursor(lcdShift, 0);
lcd.print(num1);
} else {
num2 = num2 + keyPress;
numLen2 = num2.length();
lcd.setCursor(lcdShift + 2, 0);
lcd.print(num2);
endOfOperation = true;
}
} else if ((keyPress == '+' || keyPress == '-' || keyPress == '*' || keyPress == '/' ) && currentVal == false && keyPress != NO_KEY)
{
if (currentVal == false) {
currentVal = true;
operatorr = keyPress;
lcd.autoscroll();
lcd.setCursor(lcdShift + 3, 0);
lcd.print(operatorr);