Keypad shield programing problem

Hi, I modifying this program for arduino keypad shield:

// Demo of a Keypad LCD Shield
// Common design sold by DFRobot, various vendors on eBay etc

#include <LiquidCrystal.h>
#include <DFR_LCD_Keypad.h>


byte de[8] = {
  B01000,
  B00100,
  B00010,
  B11111,
  B11111,
  B00010,
  B00100,
  B01000
};
byte le[8] = {
  B00010,
  B00100,
  B01000,
  B11111,
  B11111,
  B01000,
  B00100,
  B00010
};


// this is factory config shield initialisation
LiquidCrystal lcd(8,9,4,5,6,7); 

// below is for shield which has been modified (author's shield)
//LiquidCrystal lcd(8,3,4,5,6,7); 

// initialise the keypad
DFR_LCD_Keypad keypad(A0, &lcd);

int last_key, key;

int nhitrost = 0;
float ntemp = 0;
//float temp1 = 255; 
int smer = 0;

void setup()
{
  lcd.begin(16,2);

  lcd.createChar(1, de);
  lcd.createChar(2, le);

  
 lcd.setCursor(0,0);
  //lcd.print("Press keys now");
 lcd.print("FilaBruh    V1.1");
 lcd.setCursor(0,1);
 lcd.print("BENO  &  R.P.3D");
 delay (6000);

 lcd.clear();
}

void loop()
{
lcd.setCursor (0,0);
lcd.print ("nT=");
lcd.setCursor (3,0);
lcd.print (ntemp, 0);
lcd.setCursor(0,1);
lcd.print ("nH=");
lcd.print (nhitrost);
//lcd.setCursor(14,1);
//lcd.print ("S");
//lcd.setCursor(7,0);
//lcd.print ("Tg=");
lcd.setCursor(10,1);
lcd.print (smer);

  
  last_key = keypad.get_last_key();
  key      = keypad.read_key();
  
  // only clear and update the LCD if they key state has changed
  if (key != last_key) {
    // key has changed
    
    lcd.clear();
    lcd.setCursor(0,0);
    
    // print the key selection to the LCD
    switch (key) {
      case KEY_RIGHT:
 nhitrost = (nhitrost + 1);
 if (nhitrost >= 50) nhitrost = 0;
 delay (50);
 lcd.clear();
        break;
        
      case KEY_UP:
ntemp = (ntemp + 1);
if (ntemp >= 300) ntemp = 0;
delay (50);
lcd.clear();
        break;
        
      case KEY_DOWN:
ntemp = (ntemp - 1);
if (ntemp < 0) ntemp = 0;
delay (50);
lcd.clear();
        break;
        
      case KEY_LEFT:
nhitrost = (nhitrost - 1);
if (nhitrost < 0) nhitrost = 0;
delay (50);
lcd.clear();
        break;

      case KEY_SELECT:
smer = (smer + 1);
if (smer > 1) smer = 0;
delay (50);
lcd.clear();
        break;
        
      case KEY_NONE:
      default:
        //lcd.print("NONE");
        break;
    }
  }

 /*   
    if (smer = 0) {
    lcd.setCursor(14,1);
    lcd.write (1);
    }
    if (smer = 1) {
    lcd.setCursor(14,1);
    lcd.write (2);
    }
 */
  
  delay(10);// optional, but recommended if you are not debouncing the keys
}

But as soon as I add some "if sentence" the counting of button stops.
For example, if i uncomment this at the end of the code:

    if (smer = 0) {
    lcd.setCursor(14,1);
    lcd.write (1);
    }
    if (smer = 1) {
    lcd.setCursor(14,1);
    lcd.write (2);

The select button does no longer count between 0 and 1.

Thank you for your help.

  if (smer = 0) {

Check out the reference for the if statement. = for assignment == for comparison.

OMG, how could I overlooked this. Code now works. Thank you very much.

    if (smer == 0) {
    lcd.setCursor(14,1);
    lcd.write (1);
    }
    if (smer == 1) {
    lcd.setCursor(14,1);
    lcd.write (2);
    }

Guess why I spotted it so quickly?

groundFungus:
Guess why I spotted it so quickly?

Tell me.