Arduino Mega compatible.. Communication problem

hello there..
I am working on a project : control relay board 12 channel with Arduino Mega compatible (Wemos) and cayenne platform
the ESP code send the relay status by serial.write function to the Arduino Mega code and received with the serial.read function.. the serial monitor return the right result but the respond is false
(in the code: only the first condition of "if statement" is executed whatever the result of relay status)
how can I fix this?
sorry for the bad englisch :-[

ESP8266 code:

#define CAYENNE_PRINT Serial
#include <CayenneMQTTESP8266.h>

// network name and password.
char ssid[] = "FD";
char wifiPassword[] = "26592";

char username[] = "*********************************";
char password[] = "*********************************";
char clientID[] = "*********************************";

void setup()
{ 
  Serial.begin(115200);
  Cayenne.begin(username, password, clientID, ssid, wifiPassword);
}

void loop()
{
  Cayenne.loop();
}


CAYENNE_IN(0)
{
  
  CAYENNE_LOG("%u%s", request.channel, getValue.asStr());
  int i = getValue.asInt();
  int c = request.channel;
  if (Serial.available()) {
    Serial.write(i);
    Serial.write(c);

   }
}


CAYENNE_IN(1)
{
   CAYENNE_LOG("%u%s", request.channel, getValue.asStr());
  int i = getValue.asInt();
  int c = request.channel;
  if (Serial.available()) {
    Serial.write(i);
    Serial.write(c);

   }
}

Arduino Mega code:

#define RELAY_DIGITAL_PIN_0 35
#define RELAY_DIGITAL_PIN_1 36

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

 pinMode(RELAY_DIGITAL_PIN_0, OUTPUT);
 pinMode(RELAY_DIGITAL_PIN_1, OUTPUT);

}


void loop()
{

  if (Serial.available()) {
   
    String ser = Serial.readString();
    String ser1 = getStringPartByNr(ser, ']', 1);
  
    Serial.print(ser1);

if (ser1 = "00") {
  digitalWrite(RELAY_DIGITAL_PIN_0, HIGH);

} else if(ser1 = "01") {
  digitalWrite(RELAY_DIGITAL_PIN_0, LOW);
  
} else if(ser1 = "10") {
  digitalWrite(RELAY_DIGITAL_PIN_1, HIGH);
  
} else if(ser1 = "11") {
  digitalWrite(RELAY_DIGITAL_PIN_1, LOW);
}

  }
  

}

hier is the serial monitor respond:

If you want this transferred there are some other sections.

I fixed it :slight_smile: :slight_smile: :slight_smile: :slight_smile:

Thank you

I should have assigned the if statement with 2 equal sign

if (ser2 == "00") {
}

Thanks for letting people know your fix.

Bob.