Problems with dc motor

Hello everyone,im trying to control a dc motor trough the monitor ,im using this circuits but for some reason when i connect both wires from the l293d to the motor, the second one starts making an acute noise .

im using this code:

const int enablePin = 6;
const int in1Pin = 5;
const int in2Pin = 4;

void setup(){
Serial.begin(9600);
pinMode(enablePin, OUTPUT);
pinMode(in1Pin, OUTPUT);
pinMode(in2Pin, OUTPUT);
Serial.println(“speed (0-9),direction( + –)”);
}

void loop(){
if ( Serial.available()) {
int lectura = Serial.read();
if(lectura >= ‘0’ && lectura <= ‘9’){
int speed= map(lectura, ‘0’, ‘9’, 0, 255);
analogWrite(enablePin, speed);
Serial.println(speed);
}else if (lectura == ‘+’){
Serial.println(“foward”);
digitalWrite(in1Pin,LOW);
digitalWrite(in2Pin,HIGH);
}else if (lectura == ‘-’){
Serial.println(“backwards”);
digitalWrite(in1Pin,HIGH);
digitalWrite(in2Pin,LOW);
}else{
Serial.print("wrong value ");
Serial.println(lectura);
}
}
}

The noise is probably the PWM frequency, the Arduino by default uses 1kHz or 500Hz or so, depending on which pin, which are very audible. Your circuit lacks decoupling capacitor on either of the supply voltages to the L293D. Add 100nF to the logic supply (right close to the pin) and 10uF or more electrolytic on the motor supply if you can.