Receiving a char through Serial Communication XBEE

Hello,
I am doing a project where in the end I want to remote control 4 servos using two arduinos communicating with XBEE modules. I am new two XBEE so I started with simple examples to learn how it works. Now my problem. I modified an example where I use one Arduino that sends alternately a 'H' or a 'L'.
At the controller Arduino H turns on a red Led and a blue Led off, L does vice versa. The program works well.

Router

void setup() {
  Serial.begin(9600);

}

void loop() {
  Serial.print('H');
  delay(1000);
  Serial.print('L');
  delay(1000);

}

Coordinator

int RED=13;
int BLUE=12;
void setup() {
  Serial.begin(9600);
  pinMode(RED, OUTPUT);
  pinMode(BLUE, OUTPUT);
}

void loop() {
  if(Serial.available()) 
  {
    byte daten = Serial.read();
    if(daten == 'H'){
      digitalWrite(RED, HIGH);
      digitalWrite(BLUE,LOW);
      Serial.print(daten);
    }
    else if(daten == 'L'){
      digitalWrite(BLUE, HIGH);
      digitalWrite(RED,LOW);
      Serial.print(daten);
    }
    
    
  }
}

My Problem:
The program works as it should when I save the incoming data as a byte. The Leds blink as they should and on the serial monitor it prints 72767276 and so on as it should once every second. However when I save the data in a char the program does not work. The Leds are on all the time and in the serial monitor it print LS at a very high frequency. Could someone explain to me what the problem is. This is important to me because in my main project I want to be able to receive characters. I am new to this forum and I searched for this problem in the forum already but I did not find anything. Should this be a double post I am sorry and just send me the link for an older discussion.

Thanks for any help.

Could someone explain to me what the problem is.

Must be something in the code you didn’t post. A char is a signed 8 bit type. A byte is an unsigned 8 bit type. They are, usually, completely interchangeable, as long as the value being stored in the variable is less than 127.

This is the other code using char instead of byte to store the data. It is the same except for the variable type.

int RED=13;
int BLUE=12;
void setup() {
  Serial.begin(9600);
  pinMode(RED, OUTPUT);
  pinMode(BLUE, OUTPUT);
}

void loop() {
  if(Serial.available()) 
  {
    char daten = Serial.read();
    if(daten== 'H'){
      digitalWrite(RED, HIGH);
      digitalWrite(BLUE,LOW);
      Serial.print(daten);
    }
    else if(daten == 'L'){
      digitalWrite(BLUE, HIGH);
      digitalWrite(RED,LOW);
      Serial.print(daten);
    }
    
    
  }
}

I’m curious why you print the value in daten only if it is ‘H’ or ‘L’. Printing the value that you read, regardless of what it is, might provide a clue.

I changed the Code so that it prints out daten no matter what it is. In the serial monitor it prints out LHLH... at a very high frequency just as before. I am really clueless.

int RED=13;
int BLUE=12;
void setup() {
  Serial.begin(9600);
  pinMode(RED, OUTPUT);
  pinMode(BLUE, OUTPUT);
}

void loop() {
  if(Serial.available()) 
  {
    char daten = Serial.read();
    if(daten== 'H'){
      digitalWrite(RED, HIGH);
      digitalWrite(BLUE,LOW);
    }
    else if(daten == 'L'){
      digitalWrite(BLUE, HIGH);
      digitalWrite(RED,LOW);
    }
    Serial.print(daten);
    
  }
}

I am really clueless.

If changing char to byte, on line 12 in the above code, is the ONLY change that you make, and the results are different, so am I.