LCD Programming Problem

Hi, i'm currently doing a project on a 4 combo lock whereby the user have to press the 1st button x amount of times and 2nd button to insert x into an array called entered, if the values of entered array is equals to code array it will print out a message "Access granted", else if not then it prints out a message "Access Denied". I'm able to print out the message in the serial monitor (which is for testing purpose), now i want to print out the exact same message to the LCD display, but when i add "lcd.begin(16,2)" in the setup function the messages stops printing in the serial monitor....can anyone explain to me as to why this happens?I'm new to this....and also, sorry for my bad grammar....
The link of the library i used for rgb_lcd.h

Below and also attached is my source code:

The components im using are as follows:
Arduino Yun
Seeed Studio Base Shield
Grove - Button X 2 (Connected to D2 & D3 On Base Shield)
Grove - LCD RGB Backlight

Tks in advance

#include <Wire.h>
#include "rgb_lcd.h"

rgb_lcd lcd;

const int  Up_buttonPin   = 2;   
const int  Down_buttonPin = 3;


int buttonPushCounter = 0;   
int up_buttonState = 0;        
int up_lastButtonState = 0;    

int down_buttonState = 0;         
int down_lastButtonState = 0;     
bool bPress = false;

int code [] = {4,3,2,1};
int entered [4];
int i;
int counter = 0;

void setup()
{
 Serial.begin(9600);
 pinMode( Up_buttonPin , INPUT);
 pinMode( Down_buttonPin , INPUT);
}

void loop()
{
  checkUp();
  checkDown();

  if( bPress){
      bPress = false;
  }
 
}

void checkUp()
{
 up_buttonState = digitalRead(Up_buttonPin);


 if (up_buttonState != up_lastButtonState) 
 {

   if (up_buttonState == LOW) 
   {
       bPress = true;

     buttonPushCounter++;
     Serial.print("number of button pushes: ");
     Serial.println(buttonPushCounter);
   } else 
   {
     
     Serial.println("off");
   }
   // Delay a little bit to avoid bouncing
   delay(50);
 }

 up_lastButtonState = up_buttonState;
}
void checkDown()
{
 down_buttonState = digitalRead(Down_buttonPin);

 if (down_buttonState != down_lastButtonState) 
 {
   if (down_buttonState == LOW) 
   {
       bPress = true;
       if(counter < 4)
       {
           for(i=0;i<5;i++)
           {
             if(entered[i] == 0)
             {
                entered[i] = buttonPushCounter;
                buttonPushCounter = 0;  
             }
           }
           for(i = 0; i < 4; i++)
           {
               Serial.println(entered[i]);
           } 
           counter ++;
           Serial.println("Counter is : " + counter); 
       }
       else
       {
         checkcode();
       }
   } else 
   {
  
     Serial.println("off");
   }
 
   delay(50);
 }

 down_lastButtonState = down_buttonState;
}
void checkcode()
{
 if ((entered[0]==code[0]) && (entered[1]==code[1]) && (entered[2]==code[2]) && (entered[3]==code[3]))
 {
   Serial.println("Access Granted");
   reset();
 }
 else
 {
   Serial.println("Accesss Denied");
   reset();
 }
}

void reset()
{
   memset(entered,0,sizeof(entered));
   counter = 0;
   buttonPushCounter = 0;
}

ButtonLock.ino (3.17 KB)

What exactly do you mean by "my code stops working"?

Please post a link (using the chain links icon on the forum toolbar to make it clickable) to where you downloaded the rgb_lcd library from. Or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries in the Arduino IDE or Libraries > Library Manager in the Arduino Web Editor) then say so and state the full name of the library.

const int  Up_buttonPin   = 2;   
const int  Down_buttonPin = 3;

From what I can see on the YUN pinout documentation, pins 2 and 3 are SDA/SCL for the i2c bus.

I don't understand the interaction with Serial, but try to move the up/down buttons to different pins with the lcd.