LCD Code upload confusion with STMBoard

Hello! Am currently experiencing an issue where I upload my code onto an STM32F401RE board and while it works perfectly fine plugged in to my laptop with the code, when I try to plug into another outlet and test the code the LCD display won't display the text I have written.

#include <Servo.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(6, 7, 8, 9, 10, 11); 

Servo servo1;
int servoposition = 0;

const int BUTTON_PIN = 2;
const int LED_PIN = 3;
byte lastButtonState = LOW;
byte ledState = LOW;
const unsigned long eventInterval = 55;
unsigned long previousTime = 0;


void setup(){

servo1.attach(5);
pinMode(BUTTON_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
lcd.begin(16, 2); 
Serial.begin(9600);
}

void loop() {

// TEST CASE 1
// PUSHBUTTON

byte buttonState = digitalRead(BUTTON_PIN);

if (buttonState != lastButtonState) {
  lastButtonState = buttonState;
  if (buttonState == LOW) {
    ledState = (ledState == HIGH) ? LOW: HIGH;
    digitalWrite(LED_PIN, ledState);

  }
}

// TEST CASE 2 
// SERVO
  
//   for(int position = 0; position <= 180; position += 1){
//  	      servo1.write(position+5); 
//       }
//   for(int position = 180; position >= 0; position -= 1){
//  	      servo1.write(position-5); 
//       }
// }


// TEST CASE 3
//LCD

lcd.setCursor(0, 0);
lcd.print("Hello World!");

}

I am still currently adding more code onto this (which explains several unused variables)

When I plug into another device, test case 1 works perfectly fine but the text from test case 3 will not appear. Am unsure why if there was an uploading error how one part of the code would work while the other does not instead of just everything not working. Any help would be appreciated!

Please explain what you did exactly.

So I would plug in my stm board into my laptop, compile, then upload my code through the arduino ide. Once the code had been uploaded I could see the text display on the LCD just fine. However, the moment I unplug my board from the computer and try it with any other USB port, all my test cases work aside from the LCD one. I simply get a top bar filled with white cubes and an empty bottom bar. Even when I plug the board back into my original computer (with the arduino ide) the issue appears. it seems the board can't "remember" what the LCD is supposed to do after the code has been uploaded and the board unplugged. Very confused with this issue.

I'm not familiar with your STM board and can't explain the behaviour.