Noob here. I need help with debugging HC-05 module code

Hi there, I am new to Arduino and coding in general. I am using an HC-05 module to communicate with my phone. I'm fairly sure there is something illogical about this code but I cant figure out what.
any help will be greatly appreciated.

#define LED1pin 4
#define LED2pin 5

bool Led1;
bool Led2;

void setup() {
  Serial.begin(9600);
  pinMode(LED1pin, OUTPUT);
  pinMode(LED2pin, OUTPUT);
}
void loop(){
  

UpdateInstructions();
  if (Led1 == true){digitalWrite( LED1pin, HIGH);digitalWrite( LED2pin, LOW);}
  else if (Led2 == true){digitalWrite( LED2pin, HIGH);digitalWrite( LED1pin, LOW);}
}

void UpdateInstructions(){
 if(Serial.available()){
    char ReadChar = Serial.read();
    if (ReadChar == 'm'){ Led1 = true; Led2 = false;}
    else if (ReadChar == 'a'){Led2 = true; Led1 = false;}
  }
 }

Why do you think it's illogical? I can see that it's extremely poorly formatted...

Hello
Take a view onto the SWITCH/CASE instruction to find a smart solution.

1 Like

Oh yes that could do it thank you. Appologies for such a trivial post

Trivial is subjective. But please don't delete your posts. It destroys the context of the answers.

1 Like

Hello
Post your solution.