A problem of an error occurred while uploading the sketch

Hello everyone,
I'm using a serial communication (USB) for Raspberry Pi 4 B to code and power supply an Aruino Uno.
I have selected the port "/dev/ttyACM0" however I'm getting "An error occurred while uploading the sketch"

I'm trying to apload the following code :

#define EN2 8
#define DIR2 9
#define ST2 10


void setup(){
pinMode(EN2, OUTPUT);
pinMode(DIR2, OUTPUT);
pinMode(ST2, OUTPUT);
}

void loop(){
//  if (Serial.available() > 0) {
//    String data = Serial.readStringUntil('/n');
//    Serial.println(data);
//    if (data == "Go"){ 
digitalWrite(EN2, HIGH);
digitalWrite(DIR2, HIGH);
digitalWrite(ST2, HIGH);
delayMicroseconds(5000);
//delay(1);
digitalWrite(ST2, LOW);
//delay(1);
delayMicroseconds(5000);
//if (data == "S"){digitalWrite(EN2, LOW);}
//}
  
}

Please help.
Thank you in advance.

You probably have more details than that :wink:

Please disable verbose output during compilation and enable verbose output during upload under file -> preferences in the IDE. Perform an upload and post the full output here.

Which version of the IDE are you using? I'm not familiar with the Pi but on (most) Linux systems you'll have to make yourself a member of the dialout group.