I am currently having a problem with my LCD for the following code:
void loop() {
for(i=0;i<2;i++)
{
keyNew2[i] = keypad.waitForKey();
lcd.print(keyNew2[i]);
count ++;
}
while(count == 2)
{
char key = keypad.getKey();
if(key == '#')
{
count ++;
}
}
while(count == 3)
{
d = atoi(keyNew2);
count = 0;
}
if((d = 1) || (d = 2) || (d = 4) || (d = 5))
{
lcd.setCursor(0,2);
lcd.print("Windage: ");
lcd.setCursor(0,3);
lcd.print(" RIGHT");
lcd.print(" ");
lcd.print(d / 2);
}
else if (d = 3)
{
lcd.setCursor(0,2);
lcd.print("Windage: ");
lcd.setCursor(0,3);
lcd.print(" RIGHT");
lcd.print(" ");
lcd.print(d);
}
else if ((d = 7) || (d = 8) || (d = 10) || (d = 11))
{
lcd.setCursor(0,2);
lcd.print("Windage: ");
lcd.setCursor(0,3);
lcd.print(" LEFT");
lcd.print(" ");
lcd.print(d / 2);
}
else if (d = 9)
{
lcd.setCursor(0,2);
lcd.print("Windage: ");
lcd.setCursor(0,3);
lcd.print(" LEFT");
lcd.print(" ");
lcd.print(d);
}
}
No matter what value I input on the Keypad, RIGHT is displaying on the LCD. LEFT will not appear even if I change the numbers. Any help would be greatly appreciated. Thanks.