Problem uploading sketch to arduino to work with I2C Display

Hi . I've already searched the error message on Google and there was ONE result which wasn't the error I had (Google seriously has to make better systems ) I know this is a kind of famous error and is no tough one .
The 1602 display has an I2C board on the back with potentiometer and a shift register and etc etc which leaves Vin (VCC) and Negative (GND) plus SDA and SCL . Connection was done correctly with arduino uno's pin analog 5 as SCL and 4 as SDA (Power is supplied from arduino)
I've tested it with a sample code provided and it worked , so the LCD is fine as well :

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
  lcd.init();                      // initialize the lcd 
 
  // Print a message to the LCD.
  lcd.backlight();
  lcd.print("Hello, world!");
}

void loop()
{
}

This is the sample code .
The libraries support some codes (really awesome and handy codes . They seriously make programming easier )

LiquidCrystal()
begin()
clear()
home()
setCursor()
write()
print()
cursor()
noCursor()
blink()
noBlink()
display()
noDisplay()
scrollDisplayLeft()
scrollDisplayRight()
autoscroll()
noAutoscroll()
leftToRight()
rightToLeft()
createChar()

But I'm not using a lot of these . I'm using this code which involves random , if , else if , and some of these . That code is attached (it was long (the code itself was short but lots of little lines , pretty annoying to put here ! :smiley: ))
The basic idea is that if random from 1 to 10 would be 2 , the lcd would print something . Or if it became 5 , something else . The only complicated part is if it becomes 7 , where it blinks , prints "FATAL ERROR" , gets clear for a second then writes "ERROR" , gets clear and stops blinking .
This is a kind of device that is helpful for decisions (and if the random becomes 7 , it'd play a prank)
Then the error I receive :
It compiles 100 % and suddenly some orange words appear :

avrdude: stk500_getsync(): not in sync: resp=0x30

The reason is that It's set up to COM3 whilst I'm connecting it from COM4 . I don't know , I received an error which said COM4 was busy and I could use COM3 . I accepted and then when I try to compile it keeps saying this .
Drivers have been installed correctly .
Only question is how can I switch to COM4 to continue ?
Thanks in advance .

LCD.ino (834 Bytes)

The code has nothing to do with that error.

You need to verify what COM port your board is on. If you have a serial program on your computer communicating with the arduino, make sure you close it.

If you really believe your board is COM4 and getting an error it is busy, then something is stuck open. Probably good time for a reboot.

I also bet I have to change it somehow to COM4 but problem is that I don't know how . Tools > serial port only has one choice and that's COM3 which already has a tick .
The computer was rebooted after that but it's still stuck on COM3 .

Mistake I made was found and I proudly solved it without using those worthless guides I found with Google .
I hope this post would be useful to others who face these problems .
Mistake :
I wrote a code that did nothing . But It did include some Serial.Begin and Serial.Print . Then I saw some gibberish words on the serial monitor and the error came the next time I wanted to upload a code . This was the error :
> avrdude: stk500_getsync(): not in sync: resp=0x30

How I fixed :
I opened serial monitor , and then I closed it . Appearing there on Tools > Serial port was nothing but ... COM4 , what I used to program . I demonstrated the Blink code and it works ! It's like the feeling I had when I first bought my first arduino XD