Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to get my Arduino and ESP8266 to talk to each other. I am trying to send a message from my Arduino to tell my ESP to light an LED, and also get my ESP to tell the Arduino to light an LED.

My Arduino Code:

String message;

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

void loop() {

  // wait for available serial
  if(Serial.available() > 0) {
    message = Serial.readStringUntil('\n');  // read until end of line
    if (message.equals("led on\n") || message.equals("led on")) {
      digitalWrite(13, HIGH);
    }
    Serial.println("esp led on");
  }
}

My ESP Code:

#include <ESP8266WiFi.h>

String message;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
}

void loop() {
  if(Serial.available() > 0) {
    message = Serial.readStringUntil('\n');
    if (message.equals("esp led on\n") || message.equals("esp led on")) {
      digitalWrite(2, HIGH);
    }
    Serial.println("led on");
  }
}

My Setup: (Note: Fritzing didn't have a 1.8k resistor. I am getting 3.4V for my RX on my ESP)

enter image description here

Only my Arduino LED lights up, and its TX led is blinking extremely fast. My best guess is that the Serial never becomes available for the ESP, and I'm not sure how I would tackle that.

share|improve this question
    
I don't know what the problem is, but if it would help I can give you some advice on how to go about finding it. – Mark Smith Jan 28 at 17:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.