need to send character array from esp8266 to arduino uno.

Hi,

I need to send character array which is “Light On” or “Light Off” from adafruit.io to arduino uno via esp8266. If the command is “Light On”, Pin 13 should be on.

Actually arduino receiving the command, but not comparing. Because arduino receiving the characters one by one. how can i overcome this issue?

Please check the attached sketch. esp sketch is working but arduino sketch not working. please help.
Thanks

arduino uno sketch.txt (549 Bytes)

esp8266 sketch.txt (4.53 KB)

Methods for receiving multi-byte messages can be found in the serial input basics thread.

Actually I can't get the idea from serial input basics threads. Anybody can edit my sketch or create new sketch for this function.

  while(Serial.available())
  {
    delay(50);
    char c=Serial.read();
    readString+=c;
  }

Read whatever data has arrived, while repeatedly, uselessly stuffing your head in the sand.

  if(readString.length()>0)
  {
    Serial.println(readString);
    if (readString =="Light On")
    {
	digitalWrite(13, HIGH);
    }
    if (readString =="Light Off")
    {
	digitalWrite(13, LOW);
    }
    readString="";
  }

After properly positioning the curly braces, and indenting the code, I see that you are printing readString incorrectly.

Print it like so:

   Serial.print(readString: [");
   Serial.print(readString);
   Serial.print("]");

It should then be perfectly obvious why the value never matches what you expect it to.