Garbage response controling a HDMI switch

hello to all,
I'm working on a program to control via RS232 one HDMI switcher.

whole electric circuit is correct. Arduino UNO with ethernet shield and I'm using a MAX232 to convert TTL to RS232. important to note that the TTL code is created by the module SoftwareSerial.

ASCII command for input 1 is "1!\n" and input 2 is "2!\n".
both work perfectly.
But the answer is garbage.

The most interesting is that when I press the physical button switcher the answer comes correct.

to summarize, I just get the garbage when the command is sent by the Arduino UNO.

I need the correct switcher answer to update in the user monitoring interface.

thats my code.

#include <SoftwareSerial.h>


SoftwareSerial Switcher(8, 9); // RX, TX
int PowerButton1Pin = 2;
int PowerButton2Pin = 3;
int VolButtonPlusPin = 5;
int VolButtonMinusPin = 6;

boolean PowerButton1 = false;
boolean PowerButton2 = false;
boolean switchReady = true;

char inChar;


void setup()  
{
  pinMode(PowerButton1Pin, INPUT);
  digitalWrite(PowerButton1Pin,HIGH);
  pinMode(PowerButton2Pin, INPUT);
  digitalWrite(PowerButton2Pin,HIGH);
  
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  

  // set the data rate for the SoftwareSerial port
  Switcher.begin(9600);
  
}

void loop() // run over and over
{

  
  PowerButton1 = digitalRead(PowerButton1Pin);
  PowerButton2 = digitalRead(PowerButton2Pin);
  
  Switcher.listen();
  
  if(Switcher.available())
  {
    inChar = Switcher.read();
    Serial.write(inChar);
  }

  if(PowerButton1 == true && switchReady == true)
  {
    Switcher.print("1!\n");
    switchReady = false;
  }
  if(PowerButton2 == true && switchReady == true)
  {
    Switcher.print("2!\n");
    switchReady = false;
  }
  if(PowerButton1 == false && PowerButton2 == false)
  {
    switchReady = true;
  }
  
}

please help me

The problem may be that softserial is half duplex, ie it can send data or receive data but not at the same time.
If the HDMI switch sends back data at the same time you are sending data to it , then you will get garbage.
The fix is to use a hardware usart rather than softserial.

I don't think you need the call to listen -it's used when switching between multiple soft serial instances. Try a delay(10) after you read the switches to debounce them.

long shot

but I seem to remember the max232 inverts the signals, as per RS232 spec,
'1' is - volts, '0' is +ve volts on the rs232 line,